This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Expand file tree
/
Copy pathrevpdfprinter_ios.mm
More file actions
66 lines (49 loc) · 1.84 KB
/
revpdfprinter_ios.mm
File metadata and controls
66 lines (49 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* Copyright (C) 2003-2015 LiveCode Ltd.
This file is part of LiveCode.
LiveCode is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License v3 as published by the Free
Software Foundation.
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
#include "revpdfprinter.h"
#include <cairo-quartz.h>
#include <CoreFoundation/CFDate.h>
#ifdef __IPHONE_3_2
#include <CoreText/CoreText.h>
#endif
bool MCPDFPrintingDevice::create_cairo_font_from_custom_printer_font(const MCCustomPrinterFont &p_cp_font, cairo_font_face_t* &r_cairo_font)
{
#ifdef __IPHONE_3_2
bool t_success = true;
CGFontRef t_cg_font;
t_cg_font = CTFontCopyGraphicsFont((CTFontRef)p_cp_font . handle, NULL);
cairo_font_face_t *t_font;
t_font = cairo_quartz_font_face_create_for_cgfont(t_cg_font);
t_success = (m_status = cairo_font_face_status(t_font)) == CAIRO_STATUS_SUCCESS;
if (t_success)
r_cairo_font = t_font;
CGFontRelease(t_cg_font);
return t_success;
#else
return false;
#endif
}
bool MCPDFPrintingDevice::set_cairo_pdf_datetime_to_now(cairo_pdf_datetime_t &r_datetime)
{
CFAbsoluteTime t_system_time;
t_system_time = CFAbsoluteTimeGetCurrent();
CFGregorianDate t_datetime;
t_datetime = CFAbsoluteTimeGetGregorianDate(t_system_time, NULL);
r_datetime.year = t_datetime.year;
r_datetime.month = t_datetime.month;
r_datetime.day = t_datetime.day;
r_datetime.hour = t_datetime.hour;
r_datetime.minute = t_datetime.minute;
r_datetime.second = t_datetime.second;
r_datetime.utc_minute_offset = 0;
return true;
}