| 1 |
#include <stdint.h> |
| 2 |
#include <stdio.h> |
| 3 |
#include <stdlib.h> |
| 4 |
#include <string.h> |
| 5 |
|
| 6 |
#include "libcff.h" |
| 7 |
|
| 8 |
static const char *const string_standard[391] = { |
| 9 |
".notdef", |
| 10 |
"space", |
| 11 |
"exclam", |
| 12 |
"quotedbl", |
| 13 |
"numbersign", |
| 14 |
"dollar", |
| 15 |
"percent", |
| 16 |
"ampersand", |
| 17 |
"quoteright", |
| 18 |
"parenleft", |
| 19 |
"parenright", |
| 20 |
"asterisk", |
| 21 |
"plus", |
| 22 |
"comma", |
| 23 |
"hyphen", |
| 24 |
"period", |
| 25 |
"slash", |
| 26 |
"zero", |
| 27 |
"one", |
| 28 |
"two", |
| 29 |
"three", |
| 30 |
"four", |
| 31 |
"five", |
| 32 |
"six", |
| 33 |
"seven", |
| 34 |
"eight", |
| 35 |
"nine", |
| 36 |
"colon", |
| 37 |
"semicolon", |
| 38 |
"less", |
| 39 |
"equal", |
| 40 |
"greater", |
| 41 |
"question", |
| 42 |
"at", |
| 43 |
"A", |
| 44 |
"B", |
| 45 |
"C", |
| 46 |
"D", |
| 47 |
"E", |
| 48 |
"F", |
| 49 |
"G", |
| 50 |
"H", |
| 51 |
"I", |
| 52 |
"J", |
| 53 |
"K", |
| 54 |
"L", |
| 55 |
"M", |
| 56 |
"N", |
| 57 |
"O", |
| 58 |
"P", |
| 59 |
"Q", |
| 60 |
"R", |
| 61 |
"S", |
| 62 |
"T", |
| 63 |
"U", |
| 64 |
"V", |
| 65 |
"W", |
| 66 |
"X", |
| 67 |
"Y", |
| 68 |
"Z", |
| 69 |
"bracketleft", |
| 70 |
"backslash", |
| 71 |
"bracketright", |
| 72 |
"asciicircum", |
| 73 |
"underscore", |
| 74 |
"quoteleft", |
| 75 |
"a", |
| 76 |
"b", |
| 77 |
"c", |
| 78 |
"d", |
| 79 |
"e", |
| 80 |
"f", |
| 81 |
"g", |
| 82 |
"h", |
| 83 |
"i", |
| 84 |
"j", |
| 85 |
"k", |
| 86 |
"l", |
| 87 |
"m", |
| 88 |
"n", |
| 89 |
"o", |
| 90 |
"p", |
| 91 |
"q", |
| 92 |
"r", |
| 93 |
"s", |
| 94 |
"t", |
| 95 |
"u", |
| 96 |
"v", |
| 97 |
"w", |
| 98 |
"x", |
| 99 |
"y", |
| 100 |
"z", |
| 101 |
"braceleft", |
| 102 |
"bar", |
| 103 |
"braceright", |
| 104 |
"asciitilde", |
| 105 |
"exclamdown", |
| 106 |
"cent", |
| 107 |
"sterling", |
| 108 |
"fraction", |
| 109 |
"yen", |
| 110 |
"florin", |
| 111 |
"section", |
| 112 |
"currency", |
| 113 |
"quotesingle", |
| 114 |
"quotedblleft", |
| 115 |
"guillemotleft", |
| 116 |
"guilsinglleft", |
| 117 |
"guilsinglright", |
| 118 |
"fi", |
| 119 |
"fl", |
| 120 |
"endash", |
| 121 |
"dagger", |
| 122 |
"daggerdbl", |
| 123 |
"periodcentered", |
| 124 |
"paragraph", |
| 125 |
"bullet", |
| 126 |
"quotesinglbase", |
| 127 |
"quotedblbase", |
| 128 |
"quotedblright", |
| 129 |
"guillemotright", |
| 130 |
"ellipsis", |
| 131 |
"perthousand", |
| 132 |
"questiondown", |
| 133 |
"grave", |
| 134 |
"acute", |
| 135 |
"circumflex", |
| 136 |
"tilde", |
| 137 |
"macron", |
| 138 |
"breve", |
| 139 |
"dotaccent", |
| 140 |
"dieresis", |
| 141 |
"ring", |
| 142 |
"cedilla", |
| 143 |
"hungarumlaut", |
| 144 |
"ogonek", |
| 145 |
"caron", |
| 146 |
"emdash", |
| 147 |
"AE", |
| 148 |
"ordfeminine", |
| 149 |
"Lslash", |
| 150 |
"Oslash", |
| 151 |
"OE", |
| 152 |
"ordmasculine", |
| 153 |
"ae", |
| 154 |
"dotlessi", |
| 155 |
"lslash", |
| 156 |
"oslash", |
| 157 |
"oe", |
| 158 |
"germandbls", |
| 159 |
"onesuperior", |
| 160 |
"logicalnot", |
| 161 |
"mu", |
| 162 |
"trademark", |
| 163 |
"Eth", |
| 164 |
"onehalf", |
| 165 |
"plusminus", |
| 166 |
"Thorn", |
| 167 |
"onequarter", |
| 168 |
"divide", |
| 169 |
"brokenbar", |
| 170 |
"degree", |
| 171 |
"thorn", |
| 172 |
"threequarters", |
| 173 |
"twosuperior", |
| 174 |
"registered", |
| 175 |
"minus", |
| 176 |
"eth", |
| 177 |
"multiply", |
| 178 |
"threesuperior", |
| 179 |
"copyright", |
| 180 |
"Aacute", |
| 181 |
"Acircumflex", |
| 182 |
"Adieresis", |
| 183 |
"Agrave", |
| 184 |
"Aring", |
| 185 |
"Atilde", |
| 186 |
"Ccedilla", |
| 187 |
"Eacute", |
| 188 |
"Ecircumflex", |
| 189 |
"Edieresis", |
| 190 |
"Egrave", |
| 191 |
"Iacute", |
| 192 |
"Icircumflex", |
| 193 |
"Idieresis", |
| 194 |
"Igrave", |
| 195 |
"Ntilde", |
| 196 |
"Oacute", |
| 197 |
"Ocircumflex", |
| 198 |
"Odieresis", |
| 199 |
"Ograve", |
| 200 |
"Otilde", |
| 201 |
"Scaron", |
| 202 |
"Uacute", |
| 203 |
"Ucircumflex", |
| 204 |
"Udieresis", |
| 205 |
"Ugrave", |
| 206 |
"Yacute", |
| 207 |
"Ydieresis", |
| 208 |
"Zcaron", |
| 209 |
"aacute", |
| 210 |
"acircumflex", |
| 211 |
"adieresis", |
| 212 |
"agrave", |
| 213 |
"aring", |
| 214 |
"atilde", |
| 215 |
"ccedilla", |
| 216 |
"eacute", |
| 217 |
"ecircumflex", |
| 218 |
"edieresis", |
| 219 |
"egrave", |
| 220 |
"iacute", |
| 221 |
"icircumflex", |
| 222 |
"idieresis", |
| 223 |
"igrave", |
| 224 |
"ntilde", |
| 225 |
"oacute", |
| 226 |
"ocircumflex", |
| 227 |
"odieresis", |
| 228 |
"ograve", |
| 229 |
"otilde", |
| 230 |
"scaron", |
| 231 |
"uacute", |
| 232 |
"ucircumflex", |
| 233 |
"udieresis", |
| 234 |
"ugrave", |
| 235 |
"yacute", |
| 236 |
"ydieresis", |
| 237 |
"zcaron", |
| 238 |
"exclamsmall", |
| 239 |
"Hungarumlautsmall", |
| 240 |
"dollaroldstyle", |
| 241 |
"dollarsuperior", |
| 242 |
"ampersandsmall", |
| 243 |
"Acutesmall", |
| 244 |
"parenleftsuperior", |
| 245 |
"parenrightsuperior", |
| 246 |
"twodotenleader", |
| 247 |
"onedotenleader", |
| 248 |
"zerooldstyle", |
| 249 |
"oneoldstyle", |
| 250 |
"twooldstyle", |
| 251 |
"threeoldstyle", |
| 252 |
"fouroldstyle", |
| 253 |
"fiveoldstyle", |
| 254 |
"sixoldstyle", |
| 255 |
"sevenoldstyle", |
| 256 |
"eightoldstyle", |
| 257 |
"nineoldstyle", |
| 258 |
"commasuperior", |
| 259 |
"threequartersemdash", |
| 260 |
"periodsuperior", |
| 261 |
"questionsmall", |
| 262 |
"asuperior", |
| 263 |
"bsuperior", |
| 264 |
"centsuperior", |
| 265 |
"dsuperior", |
| 266 |
"esuperior", |
| 267 |
"isuperior", |
| 268 |
"lsuperior", |
| 269 |
"msuperior", |
| 270 |
"nsuperior", |
| 271 |
"osuperior", |
| 272 |
"rsuperior", |
| 273 |
"ssuperior", |
| 274 |
"tsuperior", |
| 275 |
"ff", |
| 276 |
"ffi", |
| 277 |
"ffl", |
| 278 |
"parenleftinferior", |
| 279 |
"parenrightinferior", |
| 280 |
"Circumflexsmall", |
| 281 |
"hyphensuperior", |
| 282 |
"Gravesmall", |
| 283 |
"Asmall", |
| 284 |
"Bsmall", |
| 285 |
"Csmall", |
| 286 |
"Dsmall", |
| 287 |
"Esmall", |
| 288 |
"Fsmall", |
| 289 |
"Gsmall", |
| 290 |
"Hsmall", |
| 291 |
"Ismall", |
| 292 |
"Jsmall", |
| 293 |
"Ksmall", |
| 294 |
"Lsmall", |
| 295 |
"Msmall", |
| 296 |
"Nsmall", |
| 297 |
"Osmall", |
| 298 |
"Psmall", |
| 299 |
"Qsmall", |
| 300 |
"Rsmall", |
| 301 |
"Ssmall", |
| 302 |
"Tsmall", |
| 303 |
"Usmall", |
| 304 |
"Vsmall", |
| 305 |
"Wsmall", |
| 306 |
"Xsmall", |
| 307 |
"Ysmall", |
| 308 |
"Zsmall", |
| 309 |
"colonmonetary", |
| 310 |
"onefitted", |
| 311 |
"rupiah", |
| 312 |
"Tildesmall", |
| 313 |
"exclamdownsmall", |
| 314 |
"centoldstyle", |
| 315 |
"Lslashsmall", |
| 316 |
"Scaronsmall", |
| 317 |
"Zcaronsmall", |
| 318 |
"Dieresissmall", |
| 319 |
"Brevesmall", |
| 320 |
"Caronsmall", |
| 321 |
"Dotaccentsmall", |
| 322 |
"Macronsmall", |
| 323 |
"figuredash", |
| 324 |
"hypheninferior", |
| 325 |
"Ogoneksmall", |
| 326 |
"Ringsmall", |
| 327 |
"Cedillasmall", |
| 328 |
"questiondownsmall", |
| 329 |
"oneeighth", |
| 330 |
"threeeighths", |
| 331 |
"fiveeighths", |
| 332 |
"seveneighths", |
| 333 |
"onethird", |
| 334 |
"twothirds", |
| 335 |
"zerosuperior", |
| 336 |
"foursuperior", |
| 337 |
"fivesuperior", |
| 338 |
"sixsuperior", |
| 339 |
"sevensuperior", |
| 340 |
"eightsuperior", |
| 341 |
"ninesuperior", |
| 342 |
"zeroinferior", |
| 343 |
"oneinferior", |
| 344 |
"twoinferior", |
| 345 |
"threeinferior", |
| 346 |
"fourinferior", |
| 347 |
"fiveinferior", |
| 348 |
"sixinferior", |
| 349 |
"seveninferior", |
| 350 |
"eightinferior", |
| 351 |
"nineinferior", |
| 352 |
"centinferior", |
| 353 |
"dollarinferior", |
| 354 |
"periodinferior", |
| 355 |
"commainferior", |
| 356 |
"Agravesmall", |
| 357 |
"Aacutesmall", |
| 358 |
"Acircumflexsmall", |
| 359 |
"Atildesmall", |
| 360 |
"Adieresissmall", |
| 361 |
"Aringsmall", |
| 362 |
"AEsmall", |
| 363 |
"Ccedillasmall", |
| 364 |
"Egravesmall", |
| 365 |
"Eacutesmall", |
| 366 |
"Ecircumflexsmall", |
| 367 |
"Edieresissmall", |
| 368 |
"Igravesmall", |
| 369 |
"Iacutesmall", |
| 370 |
"Icircumflexsmall", |
| 371 |
"Idieresissmall", |
| 372 |
"Ethsmall", |
| 373 |
"Ntildesmall", |
| 374 |
"Ogravesmall", |
| 375 |
"Oacutesmall", |
| 376 |
"Ocircumflexsmall", |
| 377 |
"Otildesmall", |
| 378 |
"Odieresissmall", |
| 379 |
"OEsmall", |
| 380 |
"Oslashsmall", |
| 381 |
"Ugravesmall", |
| 382 |
"Uacutesmall", |
| 383 |
"Ucircumflexsmall", |
| 384 |
"Udieresissmall", |
| 385 |
"Yacutesmall", |
| 386 |
"Thornsmall", |
| 387 |
"Ydieresissmall", |
| 388 |
"001.000", |
| 389 |
"001.001", |
| 390 |
"001.002", |
| 391 |
"001.003", |
| 392 |
"Black", |
| 393 |
"Bold", |
| 394 |
"Book", |
| 395 |
"Light", |
| 396 |
"Medium", |
| 397 |
"Regular", |
| 398 |
"Roman", |
| 399 |
"Semibold", |
| 400 |
}; |
| 401 |
|
| 402 |
sds sdsget_cff_sid(uint16_t idx, cff_Index str) { |
| 403 |
if (idx <= 390) { |
| 404 |
return sdsnew(string_standard[idx]); |
| 405 |
} else if (str.count > 0 && idx - 391 < str.count) { |
| 406 |
return sdsnewlen(str.data + str.offset[idx - 391] - 1, |
| 407 |
str.offset[idx - 390] - str.offset[idx - 391]); |
| 408 |
} else { |
| 409 |
return NULL; |
| 410 |
} |
| 411 |
} |