Merge branch 'dev' into samenamespaces

Conflicts:
	src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties
This commit is contained in:
Jindra Petřík
2016-09-17 19:01:06 +02:00
7 changed files with 54 additions and 33 deletions

View File

@@ -617,6 +617,10 @@ public class Configuration {
@ConfigurationCategory("script")
public static final ConfigurationItem<Boolean> useFlexAs3Compiler = null;
@ConfigurationDefaultBoolean(true)
@ConfigurationCategory("ui")
public static final ConfigurationItem<Boolean> showSetAdvanceValuesMessage = null;
private enum OSId {
WINDOWS, OSX, UNIX

View File

@@ -475,13 +475,13 @@ public class DefineFont2Tag extends FontTag {
}
if (fontFlagsHasLayout) {
Font fnt = new Font(fontName, fontStyle, 1024);
Font advanceFont = font.deriveFont(fontStyle, 1024); // Not multiplied with divider as it causes problems to create font with height around 20k
if (!exists) {
fontBoundsTable.add(pos, shp.getBounds());
fontAdvanceTable.add(pos, (int) getDivider() * Math.round(FontHelper.getFontAdvance(fnt, character)));
fontAdvanceTable.add(pos, (int) getDivider() * Math.round(FontHelper.getFontAdvance(advanceFont, character)));
} else {
fontBoundsTable.set(pos, shp.getBounds());
fontAdvanceTable.set(pos, (int) getDivider() * Math.round(FontHelper.getFontAdvance(fnt, character)));
fontAdvanceTable.set(pos, (int) getDivider() * Math.round(FontHelper.getFontAdvance(advanceFont, character)));
}
}
@@ -527,22 +527,26 @@ public class DefineFont2Tag extends FontTag {
@Override
public void setAdvanceValues(Font font) {
boolean hasLayout = fontFlagsHasLayout;
fontFlagsHasLayout = true;
fontAdvanceTable = new ArrayList<>();
if (!hasLayout) {
fontBoundsTable = new ArrayList<>();
fontKerningTable = new ArrayList<>();
}
for (Integer character : codeTable) {
List<RECT> newFontBoundsTable = new ArrayList<>();
List<Integer> newFontAdvanceTable = new ArrayList<>();
for (int i = 0; i < codeTable.size(); i++) {
Integer character = codeTable.get(i);
char ch = (char) (int) character;
if (!font.canDisplay(ch) && fontFlagsHasLayout) { //cannot display, leave old if exist
newFontAdvanceTable.add(fontAdvanceTable.get(i));
newFontBoundsTable.add(fontBoundsTable.get(i));
continue;
}
SHAPE shp = SHAPERECORD.fontCharacterToSHAPE(font, (int) Math.round(getDivider() * 1024), ch);
fontBoundsTable.add(shp.getBounds());
newFontBoundsTable.add(shp.getBounds());
int fontStyle = getFontStyle();
Font fnt = new Font(font.getFontName(), fontStyle, 1024); // Not multiplied with divider as it causes problems to create font with height around 20k
fontAdvanceTable.add((int) getDivider() * Math.round(FontHelper.getFontAdvance(fnt, ch)));
Font advanceFont = font.deriveFont(fontStyle, 1024); // Not multiplied with divider as it causes problems to create font with height around 20k
newFontAdvanceTable.add((int) getDivider() * Math.round(FontHelper.getFontAdvance(advanceFont, ch)));
}
fontAdvanceTable = newFontAdvanceTable;
fontBoundsTable = newFontBoundsTable;
fontKerningTable = new ArrayList<>();
fontFlagsHasLayout = true;
}
@Override

View File

@@ -468,13 +468,13 @@ public class DefineFont3Tag extends FontTag {
}
if (fontFlagsHasLayout) {
Font fnt = new Font(fontName, fontStyle, 1024); // Not multiplied with divider as it causes problems to create font with height around 20k
Font advanceFont = font.deriveFont(fontStyle, 1024); // Not multiplied with divider as it causes problems to create font with height around 20k
if (!exists) {
fontBoundsTable.add(pos, shp.getBounds());
fontAdvanceTable.add(pos, (int) getDivider() * Math.round(FontHelper.getFontAdvance(fnt, character)));
fontAdvanceTable.add(pos, (int) getDivider() * Math.round(FontHelper.getFontAdvance(advanceFont, character)));
} else {
fontBoundsTable.set(pos, shp.getBounds());
fontAdvanceTable.set(pos, (int) getDivider() * Math.round(FontHelper.getFontAdvance(fnt, character)));
fontAdvanceTable.set(pos, (int) getDivider() * Math.round(FontHelper.getFontAdvance(advanceFont, character)));
}
}
@@ -532,22 +532,26 @@ public class DefineFont3Tag extends FontTag {
@Override
public void setAdvanceValues(Font font) {
boolean hasLayout = fontFlagsHasLayout;
fontFlagsHasLayout = true;
fontAdvanceTable = new ArrayList<>();
if (!hasLayout) {
fontBoundsTable = new ArrayList<>();
fontKerningTable = new ArrayList<>();
}
for (Integer character : codeTable) {
List<RECT> newFontBoundsTable = new ArrayList<>();
List<Integer> newFontAdvanceTable = new ArrayList<>();
for (int i = 0; i < codeTable.size(); i++) {
Integer character = codeTable.get(i);
char ch = (char) (int) character;
if (!font.canDisplay(ch) && fontFlagsHasLayout) { //cannot display, leave old if exist
newFontAdvanceTable.add(fontAdvanceTable.get(i));
newFontBoundsTable.add(fontBoundsTable.get(i));
continue;
}
SHAPE shp = SHAPERECORD.fontCharacterToSHAPE(font, (int) Math.round(getDivider() * 1024), ch);
fontBoundsTable.add(shp.getBounds());
newFontBoundsTable.add(shp.getBounds());
int fontStyle = getFontStyle();
Font fnt = new Font(font.getFontName(), fontStyle, 1024); // Not multiplied with divider as it causes problems to create font with height around 20k
fontAdvanceTable.add((int) getDivider() * Math.round(FontHelper.getFontAdvance(fnt, ch)));
Font advanceFont = font.deriveFont(fontStyle, 1024); // Not multiplied with divider as it causes problems to create font with height around 20k
newFontAdvanceTable.add((int) getDivider() * Math.round(FontHelper.getFontAdvance(advanceFont, ch)));
}
fontAdvanceTable = newFontAdvanceTable;
fontBoundsTable = newFontBoundsTable;
fontKerningTable = new ArrayList<>();
fontFlagsHasLayout = true;
}
@Override