mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-18 21:08:08 +00:00
#794 Font extraction fails sometimes fixed
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters;
|
||||
|
||||
import com.google.typography.font.sfntly.Font;
|
||||
@@ -129,6 +130,7 @@ public class FontExporter {
|
||||
f.setAscender(Math.round(t.getAscent() / divider));
|
||||
f.setDescender(Math.round(t.getDescent() / divider));
|
||||
|
||||
int glyphCount = 0;
|
||||
for (int i = 0; i < shapes.size(); i++) {
|
||||
SHAPE s = shapes.get(i);
|
||||
final List<FPoint[]> contours = new ArrayList<>();
|
||||
@@ -178,7 +180,21 @@ public class FontExporter {
|
||||
if (contours.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasContour = false;
|
||||
for (FPoint[] cnt : contours) {
|
||||
if (cnt.length > 0) {
|
||||
hasContour = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasContour) {
|
||||
continue;
|
||||
}
|
||||
|
||||
FGlyph g = f.addGlyph(c);
|
||||
glyphCount++;
|
||||
double adv = t.getGlyphAdvance(i);
|
||||
if (adv != -1) {
|
||||
g.setAdvanceWidth((int) Math.round(adv / divider));
|
||||
@@ -193,6 +209,11 @@ public class FontExporter {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (glyphCount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
f.buildFont();
|
||||
|
||||
if (mode == FontExportMode.WOFF) {
|
||||
@@ -214,7 +235,6 @@ public class FontExporter {
|
||||
woffData.copyTo(fos);
|
||||
}
|
||||
ttfFile.delete();
|
||||
ttfFile.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +175,10 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali
|
||||
int w2 = (int) (prevWidth * SWF.unitDivisor / cols);
|
||||
int h2 = (int) (prevHeight * SWF.unitDivisor / cols);
|
||||
|
||||
if (maxw == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int mh = maxh * w2 / maxw;
|
||||
int mw;
|
||||
if (mh > h2) {
|
||||
|
||||
Reference in New Issue
Block a user