-
Notifications
You must be signed in to change notification settings - Fork 33
/
JXLSFont.mm
151 lines (137 loc) · 2.41 KB
/
JXLSFont.mm
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//
// JXLSFont.m
// JXLS
//
// Created by David Hoerl on 10/7/08.
// Copyright (c) 2008-2013 David Hoerl. Some rights reserved: <http://opensource.org/licenses/BSD-3-Clause>
// Copyright (c) 2013 Jan Weiß. Some rights reserved: <http://opensource.org/licenses/BSD-3-Clause>
//
#include <stdint.h>
#include <string>
#include "xlslib.h"
#if 0
#import "font.h"
#endif
using namespace xlslib_core;
using namespace xlslib_strings;
#import "JXLSFont.h"
#define FONT(a) ((xlslib_core::font_t *)(a))
@implementation JXLSFont
{
xlslib_core::font_t *_font;
}
- (instancetype)initWithFont:(void *)ft
{
self = [super init];
_font = FONT(ft);
return self;
}
- (void *)font
{
return _font;
}
- (void)setName:(NSString *)name
{
_font->SetName([name cStringUsingEncoding:NSASCIIStringEncoding]);
}
- (NSString *)name
{
const std::string& name = _font->GetName();
NSString *string = [NSString stringWithCString:name.c_str() encoding:NSASCIIStringEncoding];
return string;
}
- (void)setHeight:(uint16_t)fntheight
{
_font->SetHeight(fntheight);
}
- (uint16_t)height
{
return _font->GetHeight();
}
- (void)setBoldStyle:(boldness_option_t)fntboldness
{
_font->SetBoldStyle(fntboldness);
}
- (uint16_t)boldStyle
{
return _font->GetBoldStyle();
}
- (void)setUnderlineStyle:(underline_option_t)fntunderline
{
_font->SetUnderlineStyle(fntunderline);
}
- (uint8_t)underlineStyle
{
return _font->GetBoldStyle();
}
- (void)SetScriptStyle:(script_option_t)fntscript
{
_font->SetScriptStyle(fntscript);
}
- (uint16_t)scriptStyle
{
return _font->GetBoldStyle();
}
- (void)setColorName:(color_name_t)fntcolor
{
_font->SetColor(fntcolor);
}
- (void)setColorIndex:(unsigned8_t)fntcolor
{
_font->SetColor(fntcolor);
}
- (uint16_t)colorIndex
{
return _font->GetColorIdx();
}
#if 1
- (void)setItalic:(BOOL)it
{
_font->SetItalic(it);
}
- (BOOL)italic
{
return (BOOL)_font->GetItalic();
}
- (void)setStrikeout:(BOOL)so
{
_font->SetStrikeout(so);
}
- (BOOL)strikeOut
{
return (BOOL)_font->GetStrikeout();
}
- (void)setOutline:(BOOL)ol
{
_font->SetOutline(ol);
}
- (BOOL)outline
{
return (BOOL)_font->GetOutline();
}
- (void)setShadow:(BOOL)sh
{
_font->SetShadow(sh);
}
- (BOOL)shadow
{
return (BOOL)_font->GetShadow();
}
#endif
- (void)setFamily:(uint8_t)fam
{
_font->SetFamily(fam);
}
- (uint8_t)family
{
return _font->GetFamily();
}
- (void)setCharset:(uint8_t)fam
{
_font->SetCharset(fam);
}
- (uint8_t)charset
{
return _font->GetCharset();
}
@end