parent
51e7728521
commit
ff87465b40
6 changed files with 602 additions and 79 deletions
@ -0,0 +1,425 @@ |
||||
/*
|
||||
* Copyright © 2019 Adobe, Inc. |
||||
* |
||||
* This is part of HarfBuzz, a text shaping library. |
||||
* |
||||
* Permission is hereby granted, without written agreement and without |
||||
* license or royalty fees, to use, copy, modify, and distribute this |
||||
* software and its documentation for any purpose, provided that the |
||||
* above copyright notice and the following two paragraphs appear in |
||||
* all copies of this software. |
||||
* |
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
||||
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
||||
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
||||
* DAMAGE. |
||||
* |
||||
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
||||
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
||||
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
||||
* |
||||
* Adobe Author(s): Michiharu Ariza |
||||
*/ |
||||
|
||||
#ifndef HB_OT_CFF1_STD_STR_HH |
||||
#if 0 /* Make checks happy. */
|
||||
#define HB_OT_CFF1_STD_STR_HH |
||||
#include "hb.hh" |
||||
#endif |
||||
|
||||
_S(".notdef") |
||||
_S("space") |
||||
_S("exclam") |
||||
_S("quotedbl") |
||||
_S("numbersign") |
||||
_S("dollar") |
||||
_S("percent") |
||||
_S("ampersand") |
||||
_S("quoteright") |
||||
_S("parenleft") |
||||
_S("parenright") |
||||
_S("asterisk") |
||||
_S("plus") |
||||
_S("comma") |
||||
_S("hyphen") |
||||
_S("period") |
||||
_S("slash") |
||||
_S("zero") |
||||
_S("one") |
||||
_S("two") |
||||
_S("three") |
||||
_S("four") |
||||
_S("five") |
||||
_S("six") |
||||
_S("seven") |
||||
_S("eight") |
||||
_S("nine") |
||||
_S("colon") |
||||
_S("semicolon") |
||||
_S("less") |
||||
_S("equal") |
||||
_S("greater") |
||||
_S("question") |
||||
_S("at") |
||||
_S("A") |
||||
_S("B") |
||||
_S("C") |
||||
_S("D") |
||||
_S("E") |
||||
_S("F") |
||||
_S("G") |
||||
_S("H") |
||||
_S("I") |
||||
_S("J") |
||||
_S("K") |
||||
_S("L") |
||||
_S("M") |
||||
_S("N") |
||||
_S("O") |
||||
_S("P") |
||||
_S("Q") |
||||
_S("R") |
||||
_S("S") |
||||
_S("T") |
||||
_S("U") |
||||
_S("V") |
||||
_S("W") |
||||
_S("X") |
||||
_S("Y") |
||||
_S("Z") |
||||
_S("bracketleft") |
||||
_S("backslash") |
||||
_S("bracketright") |
||||
_S("asciicircum") |
||||
_S("underscore") |
||||
_S("quoteleft") |
||||
_S("a") |
||||
_S("b") |
||||
_S("c") |
||||
_S("d") |
||||
_S("e") |
||||
_S("f") |
||||
_S("g") |
||||
_S("h") |
||||
_S("i") |
||||
_S("j") |
||||
_S("k") |
||||
_S("l") |
||||
_S("m") |
||||
_S("n") |
||||
_S("o") |
||||
_S("p") |
||||
_S("q") |
||||
_S("r") |
||||
_S("s") |
||||
_S("t") |
||||
_S("u") |
||||
_S("v") |
||||
_S("w") |
||||
_S("x") |
||||
_S("y") |
||||
_S("z") |
||||
_S("braceleft") |
||||
_S("bar") |
||||
_S("braceright") |
||||
_S("asciitilde") |
||||
_S("exclamdown") |
||||
_S("cent") |
||||
_S("sterling") |
||||
_S("fraction") |
||||
_S("yen") |
||||
_S("florin") |
||||
_S("section") |
||||
_S("currency") |
||||
_S("quotesingle") |
||||
_S("quotedblleft") |
||||
_S("guillemotleft") |
||||
_S("guilsinglleft") |
||||
_S("guilsinglright") |
||||
_S("fi") |
||||
_S("fl") |
||||
_S("endash") |
||||
_S("dagger") |
||||
_S("daggerdbl") |
||||
_S("periodcentered") |
||||
_S("paragraph") |
||||
_S("bullet") |
||||
_S("quotesinglbase") |
||||
_S("quotedblbase") |
||||
_S("quotedblright") |
||||
_S("guillemotright") |
||||
_S("ellipsis") |
||||
_S("perthousand") |
||||
_S("questiondown") |
||||
_S("grave") |
||||
_S("acute") |
||||
_S("circumflex") |
||||
_S("tilde") |
||||
_S("macron") |
||||
_S("breve") |
||||
_S("dotaccent") |
||||
_S("dieresis") |
||||
_S("ring") |
||||
_S("cedilla") |
||||
_S("hungarumlaut") |
||||
_S("ogonek") |
||||
_S("caron") |
||||
_S("emdash") |
||||
_S("AE") |
||||
_S("ordfeminine") |
||||
_S("Lslash") |
||||
_S("Oslash") |
||||
_S("OE") |
||||
_S("ordmasculine") |
||||
_S("ae") |
||||
_S("dotlessi") |
||||
_S("lslash") |
||||
_S("oslash") |
||||
_S("oe") |
||||
_S("germandbls") |
||||
_S("onesuperior") |
||||
_S("logicalnot") |
||||
_S("mu") |
||||
_S("trademark") |
||||
_S("Eth") |
||||
_S("onehalf") |
||||
_S("plusminus") |
||||
_S("Thorn") |
||||
_S("onequarter") |
||||
_S("divide") |
||||
_S("brokenbar") |
||||
_S("degree") |
||||
_S("thorn") |
||||
_S("threequarters") |
||||
_S("twosuperior") |
||||
_S("registered") |
||||
_S("minus") |
||||
_S("eth") |
||||
_S("multiply") |
||||
_S("threesuperior") |
||||
_S("copyright") |
||||
_S("Aacute") |
||||
_S("Acircumflex") |
||||
_S("Adieresis") |
||||
_S("Agrave") |
||||
_S("Aring") |
||||
_S("Atilde") |
||||
_S("Ccedilla") |
||||
_S("Eacute") |
||||
_S("Ecircumflex") |
||||
_S("Edieresis") |
||||
_S("Egrave") |
||||
_S("Iacute") |
||||
_S("Icircumflex") |
||||
_S("Idieresis") |
||||
_S("Igrave") |
||||
_S("Ntilde") |
||||
_S("Oacute") |
||||
_S("Ocircumflex") |
||||
_S("Odieresis") |
||||
_S("Ograve") |
||||
_S("Otilde") |
||||
_S("Scaron") |
||||
_S("Uacute") |
||||
_S("Ucircumflex") |
||||
_S("Udieresis") |
||||
_S("Ugrave") |
||||
_S("Yacute") |
||||
_S("Ydieresis") |
||||
_S("Zcaron") |
||||
_S("aacute") |
||||
_S("acircumflex") |
||||
_S("adieresis") |
||||
_S("agrave") |
||||
_S("aring") |
||||
_S("atilde") |
||||
_S("ccedilla") |
||||
_S("eacute") |
||||
_S("ecircumflex") |
||||
_S("edieresis") |
||||
_S("egrave") |
||||
_S("iacute") |
||||
_S("icircumflex") |
||||
_S("idieresis") |
||||
_S("igrave") |
||||
_S("ntilde") |
||||
_S("oacute") |
||||
_S("ocircumflex") |
||||
_S("odieresis") |
||||
_S("ograve") |
||||
_S("otilde") |
||||
_S("scaron") |
||||
_S("uacute") |
||||
_S("ucircumflex") |
||||
_S("udieresis") |
||||
_S("ugrave") |
||||
_S("yacute") |
||||
_S("ydieresis") |
||||
_S("zcaron") |
||||
_S("exclamsmall") |
||||
_S("Hungarumlautsmall") |
||||
_S("dollaroldstyle") |
||||
_S("dollarsuperior") |
||||
_S("ampersandsmall") |
||||
_S("Acutesmall") |
||||
_S("parenleftsuperior") |
||||
_S("parenrightsuperior") |
||||
_S("twodotenleader") |
||||
_S("onedotenleader") |
||||
_S("zerooldstyle") |
||||
_S("oneoldstyle") |
||||
_S("twooldstyle") |
||||
_S("threeoldstyle") |
||||
_S("fouroldstyle") |
||||
_S("fiveoldstyle") |
||||
_S("sixoldstyle") |
||||
_S("sevenoldstyle") |
||||
_S("eightoldstyle") |
||||
_S("nineoldstyle") |
||||
_S("commasuperior") |
||||
_S("threequartersemdash") |
||||
_S("periodsuperior") |
||||
_S("questionsmall") |
||||
_S("asuperior") |
||||
_S("bsuperior") |
||||
_S("centsuperior") |
||||
_S("dsuperior") |
||||
_S("esuperior") |
||||
_S("isuperior") |
||||
_S("lsuperior") |
||||
_S("msuperior") |
||||
_S("nsuperior") |
||||
_S("osuperior") |
||||
_S("rsuperior") |
||||
_S("ssuperior") |
||||
_S("tsuperior") |
||||
_S("ff") |
||||
_S("ffi") |
||||
_S("ffl") |
||||
_S("parenleftinferior") |
||||
_S("parenrightinferior") |
||||
_S("Circumflexsmall") |
||||
_S("hyphensuperior") |
||||
_S("Gravesmall") |
||||
_S("Asmall") |
||||
_S("Bsmall") |
||||
_S("Csmall") |
||||
_S("Dsmall") |
||||
_S("Esmall") |
||||
_S("Fsmall") |
||||
_S("Gsmall") |
||||
_S("Hsmall") |
||||
_S("Ismall") |
||||
_S("Jsmall") |
||||
_S("Ksmall") |
||||
_S("Lsmall") |
||||
_S("Msmall") |
||||
_S("Nsmall") |
||||
_S("Osmall") |
||||
_S("Psmall") |
||||
_S("Qsmall") |
||||
_S("Rsmall") |
||||
_S("Ssmall") |
||||
_S("Tsmall") |
||||
_S("Usmall") |
||||
_S("Vsmall") |
||||
_S("Wsmall") |
||||
_S("Xsmall") |
||||
_S("Ysmall") |
||||
_S("Zsmall") |
||||
_S("colonmonetary") |
||||
_S("onefitted") |
||||
_S("rupiah") |
||||
_S("Tildesmall") |
||||
_S("exclamdownsmall") |
||||
_S("centoldstyle") |
||||
_S("Lslashsmall") |
||||
_S("Scaronsmall") |
||||
_S("Zcaronsmall") |
||||
_S("Dieresissmall") |
||||
_S("Brevesmall") |
||||
_S("Caronsmall") |
||||
_S("Dotaccentsmall") |
||||
_S("Macronsmall") |
||||
_S("figuredash") |
||||
_S("hypheninferior") |
||||
_S("Ogoneksmall") |
||||
_S("Ringsmall") |
||||
_S("Cedillasmall") |
||||
_S("questiondownsmall") |
||||
_S("oneeighth") |
||||
_S("threeeighths") |
||||
_S("fiveeighths") |
||||
_S("seveneighths") |
||||
_S("onethird") |
||||
_S("twothirds") |
||||
_S("zerosuperior") |
||||
_S("foursuperior") |
||||
_S("fivesuperior") |
||||
_S("sixsuperior") |
||||
_S("sevensuperior") |
||||
_S("eightsuperior") |
||||
_S("ninesuperior") |
||||
_S("zeroinferior") |
||||
_S("oneinferior") |
||||
_S("twoinferior") |
||||
_S("threeinferior") |
||||
_S("fourinferior") |
||||
_S("fiveinferior") |
||||
_S("sixinferior") |
||||
_S("seveninferior") |
||||
_S("eightinferior") |
||||
_S("nineinferior") |
||||
_S("centinferior") |
||||
_S("dollarinferior") |
||||
_S("periodinferior") |
||||
_S("commainferior") |
||||
_S("Agravesmall") |
||||
_S("Aacutesmall") |
||||
_S("Acircumflexsmall") |
||||
_S("Atildesmall") |
||||
_S("Adieresissmall") |
||||
_S("Aringsmall") |
||||
_S("AEsmall") |
||||
_S("Ccedillasmall") |
||||
_S("Egravesmall") |
||||
_S("Eacutesmall") |
||||
_S("Ecircumflexsmall") |
||||
_S("Edieresissmall") |
||||
_S("Igravesmall") |
||||
_S("Iacutesmall") |
||||
_S("Icircumflexsmall") |
||||
_S("Idieresissmall") |
||||
_S("Ethsmall") |
||||
_S("Ntildesmall") |
||||
_S("Ogravesmall") |
||||
_S("Oacutesmall") |
||||
_S("Ocircumflexsmall") |
||||
_S("Otildesmall") |
||||
_S("Odieresissmall") |
||||
_S("OEsmall") |
||||
_S("Oslashsmall") |
||||
_S("Ugravesmall") |
||||
_S("Uacutesmall") |
||||
_S("Ucircumflexsmall") |
||||
_S("Udieresissmall") |
||||
_S("Yacutesmall") |
||||
_S("Thornsmall") |
||||
_S("Ydieresissmall") |
||||
_S("001.000") |
||||
_S("001.001") |
||||
_S("001.002") |
||||
_S("001.003") |
||||
_S("Black") |
||||
_S("Bold") |
||||
_S("Book") |
||||
_S("Light") |
||||
_S("Medium") |
||||
_S("Regular") |
||||
_S("Roman") |
||||
_S("Semibold") |
||||
|
||||
#endif /* HB_OT_CFF1_STD_STR_HH */ |
@ -0,0 +1,91 @@ |
||||
/*
|
||||
* Copyright © 2019 Adobe, Inc. |
||||
* |
||||
* This is part of HarfBuzz, a text shaping library. |
||||
* |
||||
* Permission is hereby granted, without written agreement and without |
||||
* license or royalty fees, to use, copy, modify, and distribute this |
||||
* software and its documentation for any purpose, provided that the |
||||
* above copyright notice and the following two paragraphs appear in |
||||
* all copies of this software. |
||||
* |
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
||||
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
||||
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
||||
* DAMAGE. |
||||
* |
||||
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
||||
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
||||
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
||||
* |
||||
* Adobe Author(s): Michiharu Ariza |
||||
*/ |
||||
|
||||
#include "hb.hh" |
||||
#include "hb-ot.h" |
||||
|
||||
#include <stdlib.h> |
||||
#include <stdio.h> |
||||
|
||||
#ifdef HB_NO_OPEN |
||||
#define hb_blob_create_from_file(x) hb_blob_get_empty () |
||||
#endif |
||||
|
||||
int |
||||
main (int argc, char **argv) |
||||
{ |
||||
if (argc != 2) { |
||||
fprintf (stderr, "usage: %s font-file\n", argv[0]); |
||||
exit (1); |
||||
} |
||||
|
||||
hb_blob_t *blob = hb_blob_create_from_file (argv[1]); |
||||
hb_face_t *face = hb_face_create (blob, 0 /* first face */); |
||||
hb_font_t *font = hb_font_create (face); |
||||
hb_blob_destroy (blob); |
||||
blob = nullptr; |
||||
|
||||
|
||||
const unsigned int num_glyphs = hb_face_get_glyph_count (face); |
||||
int result = 1; |
||||
|
||||
for (hb_codepoint_t gid = 0; gid < num_glyphs; gid++) |
||||
{ |
||||
char buf[64]; |
||||
unsigned int buf_size = sizeof (buf); |
||||
if (hb_font_get_glyph_name (font, gid, buf, buf_size)) |
||||
{ |
||||
hb_codepoint_t gid_inv; |
||||
if (hb_font_get_glyph_from_name(font, buf, strlen (buf), &gid_inv)) |
||||
{ |
||||
if (gid == gid_inv) |
||||
{ |
||||
printf ("%u <-> %s\n", gid, buf); |
||||
} |
||||
else |
||||
{ |
||||
printf ("%u -> %s -> %u\n", gid, buf, gid_inv); |
||||
result = 0; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
printf ("%u -> %s -> ?\n", gid, buf); |
||||
result = 0; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
printf ("%u -> ?\n", gid); |
||||
result = 0; |
||||
} |
||||
} |
||||
|
||||
hb_font_destroy (font); |
||||
hb_face_destroy (face); |
||||
|
||||
return result; |
||||
} |
Loading…
Reference in new issue