私はApache FontBoxを使ってフォントメトリクスを取得しています。私はグリフからGeneralPathを取得し、そこからグリフの高さのような情報を取得します。Apache FontBoxのグリフ名とGeneralPath(PDFBox)
OpenTypeフォントのグリフ名からGeneralPathオブジェクトを取得しようとしています。このフォームを使用すると、正確なグリフ情報(パス)が得られます。
GeneralPath glyphPath = otfFont.getPath("uni24C8");
System.out.println(glyphPath.getBounds2D().getMaxY()); //Ok...
私はUnicodeのコードからグリフ名を取得しようとする場合は、私はグリフのためincorret情報を取得する:実際には
int glyphID = otfFont.getUnicodeCmap().getGlyphId(0x0075);
String name = otfFont.getCFF().getFont().getCharset().getNameForGID(glyphID);
GeneralPath glyphPath = otfFont.getPath(name);
System.out.println(glyphPath.getBounds2D().getMaxY()); //Incorrect...
、FontBoxは、与えられたと一致するグリフを見つけることができません名。たとえば、次の呼び出しはfalseを返します。
otfFont.hasGlyph(otfFont.getCFF().getFont().getCharset().getNameForGID(glyphID));
私は間違っていますか? "uni0075"や "uni24C8"のような名前を直接使用するたびに、正しい値が得られます。しかし、私はGlyphIdからこれらの名前を得る方法を知らない。
Ps .: otfFontはオブジェクトOpenTypeFontです。
ありがとうございます。