diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java index ceb380421..f17f101d4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java @@ -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 contours = new ArrayList<>(); @@ -178,7 +180,21 @@ public class FontExporter { if (contours.isEmpty()) { continue; } - final FGlyph g = f.addGlyph(c); + + 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(); - } } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java index 116437533..ae5872c9b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java @@ -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) {