Issue #1268 Using second glyph when two glyphs for one character during font export

GFX - compacted font - fixed advance values, also ascent/descent leading
This commit is contained in:
Jindra Petřík
2016-08-12 00:11:36 +02:00
parent 357db0bec3
commit 4bb7e612d2
2 changed files with 13 additions and 7 deletions

View File

@@ -178,6 +178,13 @@ public class FontExporter {
int glyphCount = 0;
for (int i = 0; i < shapes.size(); i++) {
//if there are more glyphs for one char (in some weird fonts), use the last glyph
char c = t.glyphToChar(i);
while (i + 1 < shapes.size() && t.glyphToChar(i + 1) == c) {
i++;
}
SHAPE s = shapes.get(i);
final List<FPoint[]> contours = new ArrayList<>();
PathExporter seb = new PathExporter(swf, s, null) {
@@ -222,7 +229,6 @@ public class FontExporter {
}
};
seb.export();
char c = t.glyphToChar(i);
FGlyph g = f.addGlyph(c);
glyphCount++;

View File

@@ -210,7 +210,7 @@ public final class DefineCompactedFont extends FontTag {
pos = i;
break;
}
return false;
}
}
@@ -218,7 +218,7 @@ public final class DefineCompactedFont extends FontTag {
if (pos == -1) {
return false;
}
font.glyphInfo.remove(pos);
font.glyphs.remove(pos);
shapeCache.remove(pos);
@@ -420,16 +420,16 @@ public final class DefineCompactedFont extends FontTag {
ret.fontFlagsWideOffsets = true;
ret.fontFlagsWideCodes = true;
ret.fontFlagsHasLayout = true;
ret.fontAscent = (getAscent());
ret.fontDescent = (getDescent());
ret.fontLeading = (getLeading());
ret.fontAscent = resize(getAscent());
ret.fontDescent = resize(getDescent());
ret.fontLeading = resize(getLeading());
ret.fontAdvanceTable = new ArrayList<>();
ret.fontBoundsTable = new ArrayList<>();
ret.codeTable = new ArrayList<>();
ret.glyphShapeTable = new ArrayList<>();
List<SHAPE> shp = getGlyphShapeTable();
for (int g = 0; g < shp.size(); g++) {
ret.fontAdvanceTable.add(resize(getGlyphAdvance(g)));
ret.fontAdvanceTable.add((int) getGlyphAdvance(g)); //already resized
ret.codeTable.add((int) glyphToChar(g));
SHAPE shpX = resizeShape(shp.get(g));