mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-30 19:47:19 +00:00
#1548 TTF export - correctly handle duplicate unicode codes
#1548 correctly handle empty generated file names
This commit is contained in:
@@ -12,7 +12,8 @@
|
||||
* 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;
|
||||
@@ -46,7 +47,9 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -175,15 +178,20 @@ public class FontExporter {
|
||||
f.setDescender(value);
|
||||
}
|
||||
|
||||
|
||||
int glyphCount = 0;
|
||||
for (int i = 0; i < shapes.size(); i++) {
|
||||
|
||||
List<Integer> reallyExportedGlyphs = new ArrayList<>();
|
||||
Set<Character> processedCharacters = new HashSet<>();
|
||||
//if there are more glyphs for one char (in some weird fonts), use the last glyph
|
||||
for (int i = shapes.size() - 1; i >= 0; i--) {
|
||||
char c = t.glyphToChar(i);
|
||||
char c = t.glyphToChar(i);
|
||||
while (i + 1 < shapes.size() && t.glyphToChar(i + 1) == c) {
|
||||
if (!processedCharacters.contains((Character) c)) {
|
||||
reallyExportedGlyphs.add(0, (Integer) i);
|
||||
processedCharacters.add((Character) c);
|
||||
}
|
||||
}
|
||||
}
|
||||
int glyphCount = 0;
|
||||
for (Integer ii : reallyExportedGlyphs) {
|
||||
int i = (int) ii;
|
||||
char c = t.glyphToChar(i);
|
||||
SHAPE s = shapes.get(i);
|
||||
final List<FPoint[]> contours = new ArrayList<>();
|
||||
PathExporter seb = new PathExporter(swf, s, null) {
|
||||
|
||||
@@ -843,13 +843,15 @@ public class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
char lastChar = sb.charAt(sb.length() - 1);
|
||||
if (lastChar == ' ') {
|
||||
sb.setLength(sb.length() - 1);
|
||||
sb.append("%20");
|
||||
} else if (lastChar == '.') {
|
||||
sb.setLength(sb.length() - 1);
|
||||
sb.append("%2E");
|
||||
if (!sb.isEmpty()) {
|
||||
char lastChar = sb.charAt(sb.length() - 1);
|
||||
if (lastChar == ' ') {
|
||||
sb.setLength(sb.length() - 1);
|
||||
sb.append("%20");
|
||||
} else if (lastChar == '.') {
|
||||
sb.setLength(sb.length() - 1);
|
||||
sb.append("%2E");
|
||||
}
|
||||
}
|
||||
|
||||
str = sb.toString();
|
||||
|
||||
Reference in New Issue
Block a user