Issue #389 Selecting font face while characters import

Issue #701 Importing from TTF file
Improved Font panel / Font embed dialog
Reloading installed fonts for other than windows systems
Removed xito Table Layout, using Oracle Table Layout instead
This commit is contained in:
Jindra Petřík
2014-10-25 20:58:32 +02:00
parent 1985ccb594
commit 8fd683d019
25 changed files with 665 additions and 4835 deletions

5
.gitignore vendored
View File

@@ -41,4 +41,7 @@ hs_err_pid*.log
/libsrc/jpproxy/build/
/libsrc/LZMA/nbproject/private/
/libsrc/ttf/nbproject/private/
/libsrc/ttf/build/
/libsrc/ttf/build/
/libsrc/tablelayout/nbproject/private/
/libsrc/tablelayout/build/
/libsrc/tablelayout/dist/

BIN
lib/tablelayout.jar Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -271,7 +271,8 @@ public final class SWF implements TreeItem, Timelined {
public Map<Integer, CharacterTag> characters = new HashMap<>();
public List<ABCContainerTag> abcList;
public JPEGTablesTag jtt;
public Map<Integer, String> sourceFontsMap = new HashMap<>();
public Map<Integer, String> sourceFontFamiliesMap = new HashMap<>();
public Map<Integer, String> sourceFontFacesMap = new HashMap<>();
public static final double unitDivisor = 20;
private static final Logger logger = Logger.getLogger(SWF.class.getName());

View File

@@ -452,7 +452,7 @@ public class Configuration {
recentFiles.set(Helper.joinStrings(recentFilesArray, "::"));
}
public static Map<String, String> getFontPairs() {
public static Map<String, String> getFontIdToFamilyMap() {
String fonts = fontPairing.get();
if (fonts == null) {
return new HashMap<>();
@@ -467,19 +467,39 @@ public class Configuration {
}
return result;
}
public static Map<String, String> getFontIdToFaceMap() {
String fonts = fontPairing.get();
if (fonts == null) {
return new HashMap<>();
}
public static void addFontPair(String fileName, int fontId, String fontName, String systemFontName) {
Map<String, String> result = new HashMap<>();
for (String pair : fonts.split("::")) {
if (!pair.isEmpty()) {
String[] splittedPair = pair.split("=");
result.put(splittedPair[0], splittedPair.length<3?"":splittedPair[2]);
}
}
return result;
}
public static void addFontPair(String fileName, int fontId, String fontName, String installedFontFamily, String installedFontFace) {
String key = fileName + "_" + fontId + "_" + fontName;
Map<String, String> fontPairs = getFontPairs();
fontPairs.put(key, systemFontName);
fontPairs.put(fontName, systemFontName);
Map<String, String> fontPairs = getFontIdToFamilyMap();
fontPairs.put(key, installedFontFamily);
fontPairs.put(fontName, installedFontFamily);
Map<String,String> facePairs = getFontIdToFaceMap();
facePairs.put(key, installedFontFace);
facePairs.put(fontName, installedFontFace);
StringBuilder sb = new StringBuilder();
int i = 0;
for (Entry<String, String> pair : fontPairs.entrySet()) {
if (i != 0) {
sb.append("::");
}
sb.append(pair.getKey()).append("=").append(pair.getValue());
sb.append(pair.getKey()).append("=").append(pair.getValue()).append("=").append(facePairs.containsKey(pair.getKey())?facePairs.get(pair.getKey()):"");
i++;
}
fontPairing.set(sb.toString());

View File

@@ -12,34 +12,84 @@
* 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.helpers;
import com.jpexs.decompiler.flash.AppResources;
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Locale;
import java.util.Locale;
import java.util.logging.Level;
import java.util.Map;
/**
*
* @author JPEXS
*/
public class FontHelper {
/**
* Gets all available fonts in the system
* @return Map<FamilyName,Map<FontNAme,Font>>
*/
public static Map<String,Map<String,Font>> getInstalledFonts(){
Map<String,Map<String,Font>> ret = new HashMap<>();
Font fonts[] = null;
try {
Class<?> clFmFactory = Class.forName("sun.font.FontManagerFactory");
Object fm = clFmFactory.getDeclaredMethod("getInstance").invoke(null);
Class<?> clFm = Class.forName("sun.font.SunFontManager");
public static String[] getInstalledFontFamilyNames() {
// todo: cannot load newly installed fonts, so this feature is disabled until i find a solution for font loading problem
if (Platform.isWindows()) {
try {
Class<?> clW32Fm = Class.forName("sun.awt.Win32FontManager");
Class<?> clSunFm = Class.forName("sun.font.SunFontManager");
Object fm = clW32Fm.newInstance();
return (String[]) clSunFm.getDeclaredMethod("getInstalledFontFamilyNames", Locale.class).invoke(fm, Locale.getDefault());
} catch (Throwable ex) {
// catch everything to avoid class not found problems, because Win32FontManager is an internal proprietary API
Logger.getLogger(FontHelper.class.getName()).log(Level.SEVERE, null, ex);
//Delete cached installed names
Field inField = clFm.getDeclaredField("installedNames");
inField.setAccessible(true);
inField.set(null, null);
//Delete cached family names
Field allFamField = clFm.getDeclaredField("allFamilies");
allFamField.setAccessible(true);
allFamField.set(fm,null);
//Delete cached fonts
Field allFonField = clFm.getDeclaredField("allFonts");
allFonField.setAccessible(true);
allFonField.set(fm, null);
fonts = (Font[]) clFm.getDeclaredMethod("getAllInstalledFonts").invoke(fm);
} catch (Throwable ex) {
//ignore
}
}
if(fonts == null){
fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
}
for(Font f:fonts){
String fam = f.getFamily(Locale.getDefault());
//Do not want Java logical fonts
if(Arrays.asList("Dialog","DialogInput","Monospaced","Serif","SansSerif").contains(fam)){
continue;
}
if(!ret.containsKey(fam)){
ret.put(fam, new HashMap<String, Font>());
}
String face = getFontFace(f);
ret.get(f.getFamily()).put(face, f);
}
return ret;
}
public static String getFontFace(Font f){
String fam = f.getFamily(Locale.getDefault());
String face = f.getFontName(Locale.getDefault());
if(face.startsWith(fam)){
face = face.substring(fam.length()).trim();
}
if(face.startsWith(".")){
face = face.substring(1);
}
return face;
}
}

View File

@@ -120,9 +120,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
public abstract int getLeading();
public static String[] fontNamesArray;
public static List<String> fontNames;
public static Map<String,Map<String,Font>> installedFonts;
public static String defaultFontName;
@@ -168,7 +166,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
}
public String getSystemFontName() {
Map<String, String> fontPairs = Configuration.getFontPairs();
Map<String, String> fontPairs = Configuration.getFontIdToFamilyMap();
String key = swf.getShortFileName() + "_" + getFontId() + "_" + getFontName();
if (fontPairs.containsKey(key)) {
return fontPairs.get(key);
@@ -224,51 +222,52 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
}
public static void reload() {
fontNamesArray = FontHelper.getInstalledFontFamilyNames();
fontNames = Arrays.asList(fontNamesArray);
if (fontNames.contains("Times New Roman")) {
installedFonts = FontHelper.getInstalledFonts();
if (installedFonts.containsKey("Times New Roman")) {
defaultFontName = "Times New Roman";
} else if (fontNames.contains("Arial")) {
} else if (installedFonts.containsKey("Arial")) {
defaultFontName = "Arial";
} else {
defaultFontName = fontNames.get(0);
defaultFontName = installedFonts.keySet().iterator().next();
}
}
public static String getFontNameWithFallback(String fontName) {
if (fontNames.contains(fontName)) {
if (installedFonts.containsKey(fontName)) {
return fontName;
}
if (fontNames.contains("Times New Roman")) {
if (installedFonts.containsKey("Times New Roman")) {
return "Times New Roman";
}
if (fontNames.contains("Arial")) {
if (installedFonts.containsKey("Arial")) {
return "Arial";
}
//Fallback to DIALOG
return "Dialog";
//First font
return installedFonts.keySet().iterator().next();
}
public static String isFontInstalled(String fontName) {
if (fontNames.contains(fontName)) {
return fontName;
public static String isFontFamilyInstalled(String fontFamily) {
if (installedFonts.containsKey(fontFamily)) {
return fontFamily;
}
if (fontName.contains("_")) {
String beforeUnderscore = fontName.substring(0, fontName.indexOf('_'));
if (fontNames.contains(beforeUnderscore)) {
if (fontFamily.contains("_")) {
String beforeUnderscore = fontFamily.substring(0, fontFamily.indexOf('_'));
if (installedFonts.containsKey(beforeUnderscore)) {
return beforeUnderscore;
}
}
return null;
}
public static String findInstalledFontName(String fontName) {
if (fontNames.contains(fontName)) {
return fontName;
public static String findInstalledFontFamily(String fontFamily) {
if (installedFonts.containsKey(fontFamily)) {
return fontFamily;
}
if (fontName.contains("_")) {
String beforeUnderscore = fontName.substring(0, fontName.indexOf('_'));
if (fontNames.contains(beforeUnderscore)) {
if (fontFamily.contains("_")) {
String beforeUnderscore = fontFamily.substring(0, fontFamily.indexOf('_'));
if (installedFonts.containsKey(beforeUnderscore)) {
return beforeUnderscore;
}
}

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.tags.base;
import java.awt.Font;
import java.util.Map;
/**
*
@@ -26,10 +27,22 @@ public class MissingCharacterHandler {
public boolean handle(FontTag font, char character) {
String fontName = font.getFontName();
if (!FontTag.fontNames.contains(fontName)) {
if (!FontTag.installedFonts.containsKey(fontName)) {
return false;
}
Font f = new Font(fontName, font.getFontStyle(), 18);
Map<String, Font> faces = FontTag.installedFonts.get(fontName);
Font f = null;
for (String face : faces.keySet()) {
Font ff = faces.get(face);
if (ff.isBold() == font.isBold() && ff.isItalic() == font.isItalic()) {
f = ff;
break;
}
}
if (f == null) {
f = faces.get(faces.keySet().iterator().next());
}
if (!f.canDisplay(character)) {
return false;
}

View File

@@ -1954,7 +1954,7 @@ public class XFLConverter {
}
int fontStyle = font.getFontStyle();
String installedFont;
if ((installedFont = FontTag.isFontInstalled(fontName)) != null) {
if ((installedFont = FontTag.isFontFamilyInstalled(fontName)) != null) {
fontName = new Font(installedFont, fontStyle, 10).getPSName();
}
String embedRanges = "";
@@ -2458,7 +2458,7 @@ public class XFLConverter {
fontStyle = font.getFontStyle();
}
String installedFont;
if ((installedFont = FontTag.isFontInstalled(fontName)) != null) {
if ((installedFont = FontTag.isFontFamilyInstalled(fontName)) != null) {
psFontName = new Font(installedFont, fontStyle, 10).getPSName();
} else {
psFontName = fontName;
@@ -2616,7 +2616,7 @@ public class XFLConverter {
size = det.fontHeight;
fontFace = fontName;
String installedFont = null;
if ((installedFont = FontTag.isFontInstalled(fontName)) != null) {
if ((installedFont = FontTag.isFontFamilyInstalled(fontName)) != null) {
fontName = installedFont;
fontFace = new Font(installedFont, (italic ? Font.ITALIC : 0) | (bold ? Font.BOLD : 0) | (!italic && !bold ? Font.PLAIN : 0), size < 0 ? 10 : size).getPSName();
}
@@ -3355,7 +3355,7 @@ public class XFLConverter {
fontName = ft.getFontName();
}
String installedFont;
if ((installedFont = FontTag.isFontInstalled(fontName)) != null) {
if ((installedFont = FontTag.isFontFamilyInstalled(fontName)) != null) {
fontFace = new Font(installedFont, (italic ? Font.ITALIC : 0) | (bold ? Font.BOLD : 0) | (!italic && !bold ? Font.PLAIN : 0), size < 0 ? 10 : size).getPSName();
} else {
fontFace = fontName;

View File

@@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="tablelayout" default="default" basedir=".">
<description>Builds, tests, and runs the project tablelayout.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="tablelayout-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +0,0 @@
build.xml.data.CRC32=e5124a5d
build.xml.script.CRC32=4efcaf5c
build.xml.stylesheet.CRC32=8064a381@1.74.2.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=e5124a5d
nbproject/build-impl.xml.script.CRC32=1a6f89d0
nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.74.2.48

View File

@@ -1,73 +0,0 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=tablelayout
application.vendor=Jindra
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=../../lib/tablelayout.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.7
javac.target=1.7
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=true
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>tablelayout</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

View File

@@ -1,470 +0,0 @@
// Copyright 2007 Xito.org
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.xito.dialog;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.Locale;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
/**
* The Layout Parser will parse well-formed HTML for the first Table declaration and generate a TableLayout
* based on the HTML described Table
*
* @author Deane Richan
*/
public class LayoutParser {
private static final String TABLE_TAG = "table";
private static final String TR_TAG = "tr";
private static final String TD_TAG = "td";
private static final String WIDTH_ATTR = "width";
private static final String MIN_WIDTH_ATTR = "min-width";
private static final String MAX_WIDTH_ATTR = "max-width";
private static final String HEIGHT_ATTR = "height";
private static final String MIN_HEIGHT_ATTR = "min-height";
private static final String MAX_HEIGHT_ATTR = "max-height";
private static final String ANCHOR_ATTR = "anchor";
private static final String CELL_SPACING_ATTR = "cellspacing";
private static final String CELL_PADDING_ATTR = "cellpadding";
private static final String ALIGN_ATTR = "align";
private static final String VALIGN_ATTR = "valign";
private static final String COLSPAN_ATTR = "colspan";
private static final String ROWSPAN_ATTR = "rowspan";
private static final String PADDING_ATTR = "padding";
private static final String ID_ATTR = "id";
private static final String PREFERRED = "preferred";
private static final String LEFT = "left";
private static final String RIGHT = "right";
private static final String TOP = "top";
private static final String BOTTOM = "bottom";
private static final String CENTER = "center";
private static final String MIDDLE = "middle";
private static final String FULL = "full";
private static final String NW = "nw";
private static final String N = "n";
private static final String NE = "ne";
private static final String E = "e";
private static final String SE = "se";
private static final String S = "s";
private static final String SW = "sw";
private static final String W = "w";
//percent values need to be in English style
private static final DecimalFormat percentFormat = new DecimalFormat("###.##%", new DecimalFormatSymbols(Locale.ENGLISH));
/** Creates a new instance of LayoutParser */
public LayoutParser() {
}
public TableLayout parse(String htmlTable) throws IOException {
return parse(new StringBufferInputStream(htmlTable));
}
public TableLayout parse(URL url) throws IOException {
try {
DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = fact.newDocumentBuilder();
return parse(docBuilder.parse(url.openStream()));
} catch (ParserConfigurationException configExp) {
configExp.printStackTrace();
throw new IOException(configExp.getMessage());
} catch (SAXException saxExp) {
saxExp.printStackTrace();
throw new IOException(saxExp.getMessage());
}
}
public TableLayout parse(InputStream in) throws IOException {
try {
DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = fact.newDocumentBuilder();
return parse(docBuilder.parse(in));
} catch (ParserConfigurationException configExp) {
configExp.printStackTrace();
throw new IOException(configExp.getMessage());
} catch (SAXException saxExp) {
saxExp.printStackTrace();
throw new IOException(saxExp.getMessage());
}
}
/**
* Parse a Document
* @param doc
* @return
* @throws java.io.IOException
*/
public TableLayout parse(Document doc) throws IOException {
return parse(doc.getDocumentElement());
}
/**
* Parse an Element
* @param element
* @return
* @throws java.io.IOException
*/
public TableLayout parse(Element element) throws IOException {
if (element.getNodeName().equalsIgnoreCase(TABLE_TAG)) {
return processTableElement(element);
}
else {
NodeList children = element.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
if (children.item(i).getNodeType() == Node.ELEMENT_NODE) {
TableLayout layout = parse((Element) children.item(i));
if (layout != null) {
return layout;
}
}
}
}
return null;
}
/**
* Process the Table Element
* @param element
* @return
* @throws java.io.IOException
*/
private TableLayout processTableElement(Element element) throws IOException {
TableLayout layout = new TableLayout();
//Get Width and Height of Table
float width = getFloat(element.getAttribute(WIDTH_ATTR));
float height = getFloat(element.getAttribute(HEIGHT_ATTR));
//default to 100% relative
if (width == 0) {
width = TableLayout.PREFERRED; //TableLayout.PERCENT_100;
}
if (height == 0) {
height = TableLayout.PREFERRED; //TableLayout.PERCENT_100;
}
layout.setWidth(width);
layout.setHeight(height);
//get min, max width and height of Table
int min_width = getInteger(element.getAttribute(MIN_WIDTH_ATTR), 0);
int max_width = getInteger(element.getAttribute(MAX_WIDTH_ATTR), Integer.MAX_VALUE);
int min_height = getInteger(element.getAttribute(MIN_HEIGHT_ATTR), 0);
int max_height = getInteger(element.getAttribute(MAX_HEIGHT_ATTR), Integer.MAX_VALUE);
layout.setMinWidth(min_width);
layout.setMaxWidth(max_width);
layout.setMinHeight(min_height);
layout.setMaxHeight(max_height);
//Anchor
layout.setAnchor(processAnchor(element.getAttribute(ANCHOR_ATTR)));
//Cell Spacing and Padding
int cs = getInteger(element.getAttribute(CELL_SPACING_ATTR), 0);
int cp = getInteger(element.getAttribute(CELL_PADDING_ATTR), 0);
int padding = cs + cp;
layout.setPadding(new Insets(padding, padding, padding, padding));
//Process Rows
NodeList possibleRows = element.getChildNodes();
for (int r = 0; r < possibleRows.getLength(); r++) {
Node n = possibleRows.item(r);
if (n.getNodeName().equalsIgnoreCase(TR_TAG) && n.getNodeType() == Node.ELEMENT_NODE) {
Element rowElement = (Element) n;
String hStr = rowElement.getAttribute(HEIGHT_ATTR);
TableLayout.Row row = new TableLayout.Row(getFloatDimensionValue(hStr));
processRow(row, rowElement);
layout.addRow(row);
}
}
//Add additional RowSpan columns.
processRowSpan(layout);
return layout;
}
/**
* When HTML uses RowSpan it automatically inserts extra columns where the
* row is spanning over so we need to insert these extra empty columns into the layout
* @param layout
*/
private void processRowSpan(TableLayout layout) {
for (int r = 0; r < layout.getRowCount(); r++) {
TableLayout.Row row = layout.getRow(r);
//check for any row spans in the columns
for (int c = 0; c < row.getColumnCount(); c++) {
TableLayout.Column col = row.getColumn(c);
if (col.rowSpan > 1) {
int span = col.rowSpan - 1;
//loop through this many rows below and insert
//extra columns
for (int s = 1; s <= span; s++) {
TableLayout.Row spanRow = layout.getRow(r + s);
if (spanRow == null) {
continue;
}
spanRow.insertEmptyColumn(c);
}
}
}
}
}
/**
* Process a Row
* @param row
* @param rowElement
*/
private void processRow(TableLayout.Row row, Element rowElement) {
NodeList possibleColumns = rowElement.getChildNodes();
for (int c = 0; c < possibleColumns.getLength(); c++) {
Node n = possibleColumns.item(c);
if (n.getNodeName().equalsIgnoreCase(TD_TAG) && n.getNodeType() == Node.ELEMENT_NODE) {
Element td = (Element) n;
row.addCol(processCol(td));
}
}
}
/**
* Process a Column
* @param colElement
* @return
*/
private TableLayout.Column processCol(Element colElement) {
TableLayout.Column col = new TableLayout.Column();
String width = colElement.getAttribute(WIDTH_ATTR);
String hAlign = colElement.getAttribute(ALIGN_ATTR);
String vAlign = colElement.getAttribute(VALIGN_ATTR);
String colSpan = colElement.getAttribute(COLSPAN_ATTR);
String rowSpan = colElement.getAttribute(ROWSPAN_ATTR);
col.width = getFloatDimensionValue(width);
//process col and row spans
try {
if (colSpan != null && !colSpan.equals("")) {
col.colSpan = Integer.parseInt(colSpan);
}
} catch (NumberFormatException badNum) {
System.err.println("Error reading colspan:" + colSpan);
}
try {
if (rowSpan != null && !rowSpan.equals("")) {
col.rowSpan = Integer.parseInt(rowSpan);
}
} catch (NumberFormatException badNum) {
System.err.println("Error reading rowspan:" + rowSpan);
}
//Horz Align
if (hAlign != null && hAlign.equalsIgnoreCase(LEFT)) {
col.hAlign = TableLayout.LEFT;
}
else if (hAlign != null && hAlign.equalsIgnoreCase(RIGHT)) {
col.hAlign = TableLayout.RIGHT;
}
else if (hAlign != null && (hAlign.equalsIgnoreCase(MIDDLE) || hAlign.equalsIgnoreCase(CENTER))) {
col.hAlign = TableLayout.CENTER;
}
else if (hAlign != null && hAlign.equalsIgnoreCase(FULL)) {
col.hAlign = TableLayout.FULL;
}
//Vert Align
if (vAlign.equals(TOP)) {
col.vAlign = TableLayout.TOP;
}
else if (vAlign.equals(BOTTOM)) {
col.vAlign = TableLayout.BOTTOM;
}
else if (vAlign.equals(CENTER) || vAlign.equals(MIDDLE)) {
col.vAlign = TableLayout.CENTER;
}
else if (vAlign.equals(FULL)) {
col.vAlign = TableLayout.FULL;
}
//Process padding
col.padding = processColPadding(colElement.getAttribute(PADDING_ATTR));
//First look for name in ID
col.name = colElement.getAttribute(ID_ATTR);
//Look for name in Text Node if it wasn't in ID
if (col.name == null || col.name.length() == 0) {
try {
NodeList childNodes = colElement.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
if (childNodes.item(i).getNodeType() == Node.TEXT_NODE) {
col.name = childNodes.item(i).getNodeValue();
break;
}
}
} catch (DOMException badDOM) {
System.err.println("Error reading col name");
badDOM.printStackTrace();
}
}
return col;
}
public Insets processColPadding(String s) {
if (s == null || s.equals("")) {
return null;
}
Insets insets = new Insets(0, 0, 0, 0);
String values[] = s.split(",");
for (int i = 0; i < values.length; i++) {
if (i == 0) {
insets.top = getInteger(values[i], 0);
}
if (i == 1) {
insets.left = getInteger(values[i], 0);
}
if (i == 2) {
insets.bottom = getInteger(values[i], 0);
}
if (i == 3) {
insets.right = getInteger(values[i], 0);
}
}
return insets;
}
/**
* Returns the integer value or 0
*/
private int getInteger(String s, int defaultValue) {
if (s == null || s.equals("")) {
return defaultValue;
}
try {
return Integer.parseInt(s);
} catch (NumberFormatException badNum) {
return defaultValue;
}
}
/**
* Returns the integer value or 0
*/
private float getFloat(String s) {
try {
if (s.endsWith("%")) {
//JPEXS modified
float p = percentFormat.parse(s).floatValue();
if(p == 1)
{
return TableLayout.PERCENT_100;
}
return p;
}
else {
return Float.parseFloat(s);
}
} catch (ParseException parseExp) {
return 0;
} catch (NumberFormatException badNum) {
return 0;
}
}
/**
* Returns the Anchor int value for the specified String
* defaults to NORTH_WEST
*/
public int processAnchor(String s) {
if (s == null || s.equals("")) {
return TableLayout.NORTH_WEST;
}
if (s.equalsIgnoreCase(NW)) {
return TableLayout.NORTH_WEST;
}
else if (s.equalsIgnoreCase(N)) {
return TableLayout.NORTH;
}
else if (s.equalsIgnoreCase(NE)) {
return TableLayout.NORTH_EAST;
}
else if (s.equalsIgnoreCase(E)) {
return TableLayout.EAST;
}
else if (s.equalsIgnoreCase(SE)) {
return TableLayout.SOUTH_EAST;
}
else if (s.equalsIgnoreCase(S)) {
return TableLayout.SOUTH;
}
else if (s.equalsIgnoreCase(SW)) {
return TableLayout.SOUTH_WEST;
}
else if (s.equalsIgnoreCase(W)) {
return TableLayout.WEST;
}
else if (s.equalsIgnoreCase(CENTER)) {
return TableLayout.CENTER;
}
return TableLayout.NORTH_WEST;
}
private float getFloatDimensionValue(String s) {
if (s == null || s.equals("") || s.equalsIgnoreCase(PREFERRED)) {
return TableLayout.PREFERRED;
}
if (s.equals("100%")) {
return TableLayout.PERCENT_100;
}
try {
if (s.endsWith("%")) {
return percentFormat.parse(s).floatValue();
}
else {
return Float.parseFloat(s);
}
} catch (ParseException parseExp) {
System.err.println("Error parsing Dimension value:" + s);
return TableLayout.PREFERRED;
} catch (NumberFormatException badNum) {
System.err.println("Error parsing Dimension value:" + s);
return TableLayout.PREFERRED;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -162,7 +162,6 @@ public class Fontastic {
*/
public void buildFont() throws FileNotFoundException {
// Create TTF file with doubletype
m_engine.getTypeface().addRequiredGlyphs();
//m_engine.fireAction();
//m_engine.addDefaultGlyphs();
@@ -202,7 +201,7 @@ public class Fontastic {
}
glyphFile.saveGlyphFile();
}
m_engine.getTypeface().addRequiredGlyphs();
m_engine.buildTrueType(false);
// End TTF creation

View File

@@ -187,7 +187,7 @@
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">
<compilation-unit>
<package-root>src</package-root>
<classpath mode="compile">lib/LZMA.jar;lib/jna-3.5.1.jar;lib/jpproxy.jar;lib/jsyntaxpane-0.9.5.jar;lib/trident-6.2.jar;lib/substance-flamingo-6.2.jar;lib/flamingo-6.2.jar;lib/substance-6.2.jar;lib/jl1.0.1.jar;lib/nellymoser.jar;lib/gif.jar;lib/avi.jar;lib/ttf.jar;lib/jpacker.jar;lib/sfntly.jar;lib/gnujpdf.jar;libsrc/ffdec_lib/src;lib/JavactiveX.jar</classpath>
<classpath mode="compile">lib/LZMA.jar;lib/jna-3.5.1.jar;lib/jpproxy.jar;lib/jsyntaxpane-0.9.5.jar;lib/trident-6.2.jar;lib/substance-flamingo-6.2.jar;lib/flamingo-6.2.jar;lib/substance-6.2.jar;lib/jl1.0.1.jar;lib/nellymoser.jar;lib/gif.jar;lib/avi.jar;lib/ttf.jar;lib/jpacker.jar;lib/sfntly.jar;lib/gnujpdf.jar;libsrc/ffdec_lib/src;lib/JavactiveX.jar;lib/tablelayout.jar</classpath>
<built-to>build</built-to>
<built-to>javadoc</built-to>
<built-to>reports</built-to>

View File

@@ -16,30 +16,44 @@
*/
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.tags.base.FontTag;
import com.jpexs.decompiler.flash.tags.font.CharacterRanges;
import com.jpexs.helpers.Helper;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;
import java.util.Vector;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.filechooser.FileFilter;
/**
*
@@ -49,27 +63,38 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
private static final String ACTION_OK = "OK";
private static final String ACTION_CANCEL = "CANCEL";
private static final String ACTION_LOAD_FROM_DISK = "LOAD_FROM_DISK";
private static final int SAMPLE_MAX_LENGTH = 50;
private final JComboBox<String> sourceFont;
private final JComboBox<String> familyNamesSelection;
private final JComboBox<String> faceSelection;
private final JCheckBox[] rangeCheckboxes;
private final String rangeNames[];
private final JLabel[] rangeSamples;
private final JTextField individualCharsField;
private boolean result = false;
private JLabel individialSample;
private final int style;
private JLabel individialSample;
private Font customFont;
private final JCheckBox allCheckbox;
private final JCheckBox updateTextsCheckbox;
public String getSelectedFont() {
return sourceFont.getSelectedItem().toString();
public Font getSelectedFont() {
if (ttfFileRadio.isSelected() && customFont != null) {
return customFont;
}
return FontTag.installedFonts.get(familyNamesSelection.getSelectedItem().toString()).get(faceSelection.getSelectedItem().toString());
}
public boolean hasUpdateTexts(){
return updateTextsCheckbox.isSelected();
}
public Set<Integer> getSelectedChars() {
Set<Integer> chars = new TreeSet<>();
Font f = new Font(getSelectedFont(), style, new JLabel().getFont().getSize());
for (int i = 0; i < rangeCheckboxes.length; i++) {
if (rangeCheckboxes[i].isSelected()) {
Font f = getSelectedFont();
if(allCheckbox.isSelected()){
for (int i = 0; i < rangeCheckboxes.length; i++) {
int codes[] = CharacterRanges.rangeCodes(i);
for (int c : codes) {
if (f.canDisplay(c)) {
@@ -77,40 +102,135 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
}
}
}
}
String indStr = individualCharsField.getText();
for (int i = 0; i < indStr.length(); i++) {
if (f.canDisplay(indStr.codePointAt(i))) {
chars.add(indStr.codePointAt(i));
}else{
for (int i = 0; i < rangeCheckboxes.length; i++) {
if (rangeCheckboxes[i].isSelected()) {
int codes[] = CharacterRanges.rangeCodes(i);
for (int c : codes) {
if (f.canDisplay(c)) {
chars.add(c);
}
}
}
}
String indStr = individualCharsField.getText();
for (int i = 0; i < indStr.length(); i++) {
if (f.canDisplay(indStr.codePointAt(i))) {
chars.add(indStr.codePointAt(i));
}
}
}
return chars;
}
public FontEmbedDialog(String selectedFont, String selectedChars, int style) {
private JRadioButton ttfFileRadio;
private JRadioButton installedRadio;
private void updateFaceSelection(){
faceSelection.setModel( new DefaultComboBoxModel<>(new Vector<String>(FontTag.installedFonts.get(familyNamesSelection.getSelectedItem().toString()).keySet())));
}
public FontEmbedDialog(String selectedFamily, String selectedFace, String selectedChars) {
setSize(900, 600);
this.style = style;
setDefaultCloseOperation(HIDE_ON_CLOSE);
setTitle(translate("dialog.title"));
Container cnt = getContentPane();
cnt.setLayout(new BoxLayout(cnt, BoxLayout.Y_AXIS));
JPanel selFontPanel = new JPanel(new FlowLayout());
installedRadio = new JRadioButton(translate("installed"));
ttfFileRadio = new JRadioButton(translate("ttffile.noselection"));
ButtonGroup bg = new ButtonGroup();
bg.add(installedRadio);
bg.add(ttfFileRadio);
installedRadio.setSelected(true);
individialSample = new JLabel();
sourceFont = new JComboBox<>(new Vector<>(FontTag.fontNames));
sourceFont.setSelectedItem(selectedFont);
cnt.add(sourceFont);
familyNamesSelection = new JComboBox<>(new Vector<String>(new TreeSet<String>(FontTag.installedFonts.keySet())));
familyNamesSelection.setSelectedItem(selectedFamily);
faceSelection = new JComboBox<>();
updateFaceSelection();
faceSelection.setSelectedItem(selectedFace);
JButton loadFromDiskButton = new JButton(View.getIcon("open16"));
loadFromDiskButton.setToolTipText(translate("button.loadfont"));
loadFromDiskButton.addActionListener(this);
loadFromDiskButton.setActionCommand(ACTION_LOAD_FROM_DISK);
selFontPanel.add(installedRadio);
selFontPanel.add(familyNamesSelection);
selFontPanel.add(faceSelection);
selFontPanel.add(ttfFileRadio);
selFontPanel.add(loadFromDiskButton);
installedRadio.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
updateCheckboxes();
}
}
});
ttfFileRadio.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
if (ttfFileRadio.isSelected()) {
if (customFont == null) {
if (loadFromDisk()) {
updateCheckboxes();
} else {
installedRadio.setSelected(true);
}
} else {
updateCheckboxes();
}
}
}
}
});
cnt.add(selFontPanel);
JPanel rangesPanel = new JPanel();
rangesPanel.setLayout(new BoxLayout(rangesPanel, BoxLayout.Y_AXIS));
int rc = CharacterRanges.rangeCount();
final int rc = CharacterRanges.rangeCount();
rangeCheckboxes = new JCheckBox[rc];
rangeSamples = new JLabel[rc];
rangeNames = new String[rc];
allCheckbox = new JCheckBox(translate("allcharacters"));
allCheckbox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED){
for (int i = 0; i < rc; i++) {
rangeCheckboxes[i].setEnabled(false);
}
individualCharsField.setEnabled(false);
}else if(e.getStateChange() == ItemEvent.DESELECTED){
for (int i = 0; i < rc; i++) {
rangeCheckboxes[i].setEnabled(true);
}
individualCharsField.setEnabled(true);
}
}
});
JPanel rangeRowPanel = new JPanel();
rangeRowPanel.setLayout(new BorderLayout());
rangeRowPanel.add(allCheckbox,BorderLayout.WEST);
rangeRowPanel.setAlignmentX(0);
rangesPanel.add(rangeRowPanel);
for (int i = 0; i < rc; i++) {
rangeNames[i] = CharacterRanges.rangeName(i);
rangeSamples[i] = new JLabel("");
rangeCheckboxes[i] = new JCheckBox(rangeNames[i]);
JPanel rangeRowPanel = new JPanel();
rangeRowPanel = new JPanel();
rangeRowPanel.setLayout(new BoxLayout(rangeRowPanel, BoxLayout.X_AXIS));
rangeRowPanel.add(rangeCheckboxes[i]);
rangeRowPanel.add(Box.createHorizontalGlue());
@@ -127,8 +247,18 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
individualCharsField.setPreferredSize(new Dimension(100, individualCharsField.getPreferredSize().height));
individialSample = new JLabel();
specialPanel.add(individualCharsField);
updateTextsCheckbox = new JCheckBox(AppStrings.translate("font.updateTexts"));
JPanel utPanel = new JPanel(new FlowLayout());
utPanel.add(updateTextsCheckbox);
cnt.add(specialPanel);
cnt.add(individialSample);
cnt.add(utPanel);
JPanel buttonsPanel = new JPanel(new FlowLayout());
JButton okButton = new JButton(AppStrings.translate("button.ok"));
@@ -145,7 +275,15 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
setModalityType(ModalityType.APPLICATION_MODAL);
individualCharsField.setText(selectedChars);
getRootPane().setDefaultButton(okButton);
sourceFont.addItemListener(new ItemListener() {
familyNamesSelection.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
updateFaceSelection();
updateCheckboxes();
}
});
faceSelection.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
updateCheckboxes();
@@ -162,7 +300,7 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
private void updateIndividual() {
String chars = individualCharsField.getText();
Font f = new Font(getSelectedFont(), style, new JLabel().getFont().getSize());
Font f = getSelectedFont();
String visibleChars = "";
for (int i = 0; i < chars.length(); i++) {
if (f.canDisplay(chars.codePointAt(i))) {
@@ -173,9 +311,10 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
}
private void updateCheckboxes() {
String fontStr = sourceFont.getSelectedItem().toString();
Font f = new Font(fontStr, style, new JLabel().getFont().getSize());
Font f = getSelectedFont().deriveFont(12f);
int rc = CharacterRanges.rangeCount();
Set<Integer> allChars=new HashSet<>();
for (int i = 0; i < rc; i++) {
rangeNames[i] = CharacterRanges.rangeName(i);
int codes[] = CharacterRanges.rangeCodes(i);
@@ -183,6 +322,7 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
String sample = "";
for (int c = 0; c < codes.length; c++) {
if (f.canDisplay(codes[c])) {
allChars.add(codes[c]);
if (avail < SAMPLE_MAX_LENGTH) {
sample += "" + (char) codes[c];
}
@@ -193,6 +333,7 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
rangeSamples[i].setFont(f);
rangeCheckboxes[i].setText(translate("range.description").replace("%available%", "" + avail).replace("%name%", rangeNames[i]).replace("%total%", "" + codes.length));
}
allCheckbox.setText(translate("allcharacters").replace("%available%", ""+allChars.size()));
individialSample.setFont(f);
updateIndividual();
}
@@ -208,9 +349,52 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
result = false;
setVisible(false);
break;
case ACTION_LOAD_FROM_DISK:
if (customFont != null) {
if (loadFromDisk()) {
updateCheckboxes();
}
}
ttfFileRadio.setSelected(true);
break;
}
}
private boolean loadFromDisk() {
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File(Configuration.lastOpenDir.get()));
FileFilter ttfFilter = new FileFilter() {
@Override
public boolean accept(File f) {
return (f.getName().toLowerCase().endsWith(".ttf")) || (f.isDirectory());
}
@Override
public String getDescription() {
return translate("filter.ttf");
}
};
fc.setFileFilter(ttfFilter);
fc.setAcceptAllFileFilterUsed(true);
JFrame f = new JFrame();
View.setWindowIcon(f);
int returnVal = fc.showOpenDialog(f);
if (returnVal == JFileChooser.APPROVE_OPTION) {
Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath());
File selfile = Helper.fixDialogFile(fc.getSelectedFile());
try {
customFont = Font.createFont(Font.TRUETYPE_FONT, selfile);
ttfFileRadio.setText(translate("ttffile.selection").replace("%fontname%", customFont.getName()).replace("%filename%", selfile.getName()));
return true;
} catch (FontFormatException ex) {
JOptionPane.showMessageDialog(this, translate("error.invalidfontfile"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
} catch (IOException ex) {
JOptionPane.showMessageDialog(this, translate("error.cannotreadfontfile"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
}
return false;
}
public boolean display() {
result = false;
setVisible(true);

View File

@@ -1,607 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.8" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Events>
<EventHandler event="componentResized" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="formComponentResized"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="473" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="415" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Properties>
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="importTTFButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="387" max="32767" attributes="0"/>
</Group>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="fontSelection" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel10" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="fontAddCharactersField" min="-2" pref="150" max="-2" attributes="0"/>
</Group>
<Component id="fontEmbedButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="buttonEdit" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonSave" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonCancel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="100" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="fontAddCharsButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="updateTextsCheckBox" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="buttonPreviewFont" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="315" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="341" max="32767" attributes="0"/>
<Component id="importTTFButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="85" max="-2" attributes="0"/>
</Group>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel10" alignment="3" max="32767" attributes="0"/>
<Component id="fontAddCharactersField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="fontAddCharsButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="updateTextsCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fontSelection" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonPreviewFont" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="fontEmbedButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="78" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonEdit" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonSave" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonCancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="font.name" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="fontNameLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="value.unknown" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[250, 14]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[250, 14]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[250, 14]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="0" insetsRight="6" anchor="23" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="fontName.name" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="8" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
<Container class="javax.swing.JScrollPane" name="fontDisplayNameScrollPane">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
<Property name="horizontalScrollBar" type="javax.swing.JScrollBar" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="null"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="0" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="fontDisplayNameTextArea">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="columns" type="int" value="20"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new JLabel().getFont()" type="code"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="value.unknown" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="wrapStyleWord" type="boolean" value="true"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[250, 16]"/>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="fontName.copyright" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
<Container class="javax.swing.JScrollPane" name="fontCopyrightScrollPane">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
<Property name="horizontalScrollBar" type="javax.swing.JScrollBar" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="null"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="0" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="fontCopyrightTextArea">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="columns" type="int" value="20"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new JLabel().getFont()" type="code"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="value.unknown" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="wrapStyleWord" type="boolean" value="true"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[250, 16]"/>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="font.isbold" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="fontIsBoldCheckBox">
<Properties>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="0" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="font.isitalic" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="fontIsItalicCheckBox">
<Properties>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="0" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="font.ascent" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="fontAscentLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="value.unknown" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="0" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="font.descent" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="6" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="fontDescentLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="value.unknown" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="6" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="0" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="font.leading" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="7" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="fontLeadingLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="value.unknown" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="7" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="0" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel9">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="font.characters" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="8" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
<Container class="javax.swing.JScrollPane" name="fontCharactersScrollPane">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
<Property name="horizontalScrollBar" type="javax.swing.JScrollBar" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="null"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="8" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="0" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="fontCharactersTextArea">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="columns" type="int" value="20"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new JLabel().getFont()" type="code"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="wrapStyleWord" type="boolean" value="true"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[250, 16]"/>
</Property>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel10">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="font.characters.add" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<Component class="javax.swing.JTextField" name="fontAddCharactersField">
</Component>
<Component class="javax.swing.JButton" name="fontAddCharsButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="button.ok" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="fontAddCharsButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="updateTextsCheckBox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="font.updateTexts" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel11">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="font.source" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="fontSelection">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="getModel()" type="code"/>
</Property>
<Property name="selectedItem" type="java.lang.Object" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="FontTag.defaultFontName" type="code"/>
</Property>
</Properties>
<Events>
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="fontSelectionItemStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="fontEmbedButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="button.font.embed" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="fontEmbedButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonEdit">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jpexs/decompiler/flash/gui/graphics/edit16.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="button.edit" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonEditActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonSave">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jpexs/decompiler/flash/gui/graphics/save16.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="button.save" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSaveActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonCancel">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jpexs/decompiler/flash/gui/graphics/cancel16.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="button.cancel" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonCancelActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPreviewFont">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jpexs/decompiler/flash/gui/locales/MainFrame.properties" key="button.preview" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPreviewFontActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="importTTFButton">
<Properties>
<Property name="text" type="java.lang.String" value="Import TTF"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="importTTFButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@@ -18,30 +18,37 @@ package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.helpers.FontHelper;
import com.jpexs.decompiler.flash.tags.DefineFontNameTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.FontTag;
import com.jpexs.decompiler.flash.tags.base.TextTag;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
import com.jpexs.helpers.Helper;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.font.FontRenderContext;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.filechooser.FileFilter;
import layout.TableLayout;
/**
*
@@ -70,8 +77,12 @@ public class FontPanel extends javax.swing.JPanel {
fontTag = null;
}
private ComboBoxModel<String> getModel() {
return new DefaultComboBoxModel<>(FontTag.fontNamesArray);
private ComboBoxModel<String> getFamilyModel() {
return new DefaultComboBoxModel<>(new Vector<String>(new TreeSet<String>(FontTag.installedFonts.keySet())));
}
private ComboBoxModel<String> getNameModel(String family) {
return new DefaultComboBoxModel<>(new Vector<String>(FontTag.installedFonts.get(family).keySet()));
}
private void setEditable(boolean editable) {
@@ -119,7 +130,7 @@ public class FontPanel extends javax.swing.JPanel {
for (int ic : selChars) {
char c = (char) ic;
if (oldchars.indexOf((int) c) > -1) {
int opt = 0; //yes
int opt; //yes
if (!(yestoall || notoall)) {
opt = View.showOptionDialog(null, translate("message.font.add.exists").replace("%char%", "" + c), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, yesno, translate("button.yes"));
if (opt == 2) {
@@ -133,6 +144,8 @@ public class FontPanel extends javax.swing.JPanel {
opt = 0; //yes
} else if (notoall) {
opt = 1; //no
} else {
opt = 1;
}
if (opt == 1) {
@@ -185,35 +198,59 @@ public class FontPanel extends javax.swing.JPanel {
fontLeadingLabel.setText(ft.getLeading() == -1 ? translate("value.unknown") : "" + ft.getLeading());
String chars = ft.getCharacters(swf.tags);
fontCharactersTextArea.setText(chars);
setAllowSave(false);
String key = swf.getShortFileName() + "_" + ft.getFontId() + "_" + ft.getFontName();
if (swf.sourceFontsMap.containsKey(ft.getFontId())) {
fontSelection.setSelectedItem(swf.sourceFontsMap.get(ft.getFontId()));
} else if (Configuration.getFontPairs().containsKey(key)) {
fontSelection.setSelectedItem(Configuration.getFontPairs().get(key));
} else if (Configuration.getFontPairs().containsKey(ft.getFontName())) {
fontSelection.setSelectedItem(Configuration.getFontPairs().get(ft.getFontName()));
if (swf.sourceFontFamiliesMap.containsKey(ft.getFontId())) {
fontFamilyNameSelection.setSelectedItem(swf.sourceFontFamiliesMap.get(ft.getFontId()));
} else if (Configuration.getFontIdToFamilyMap().containsKey(key)) {
fontFamilyNameSelection.setSelectedItem(Configuration.getFontIdToFamilyMap().get(key));
} else if (Configuration.getFontIdToFamilyMap().containsKey(ft.getFontName())) {
fontFamilyNameSelection.setSelectedItem(Configuration.getFontIdToFamilyMap().get(ft.getFontName()));
} else {
fontSelection.setSelectedItem(FontTag.findInstalledFontName(ft.getFontName()));
fontFamilyNameSelection.setSelectedItem(FontTag.findInstalledFontFamily(ft.getFontName()));
}
if (swf.sourceFontFacesMap.containsKey(ft.getFontId())) {
fontFaceSelection.setSelectedItem(swf.sourceFontFacesMap.get(ft.getFontId()));
} else if (Configuration.getFontIdToFaceMap().containsKey(key)) {
fontFaceSelection.setSelectedItem(Configuration.getFontIdToFaceMap().get(key));
} else if (Configuration.getFontIdToFaceMap().containsKey(ft.getFontName())) {
fontFaceSelection.setSelectedItem(Configuration.getFontIdToFaceMap().get(ft.getFontName()));
} else {
java.util.Map<String, Font> faces = FontTag.installedFonts.get(fontFamilyNameSelection.getSelectedItem().toString());
boolean found = false;
for (String face : faces.keySet()) {
Font f = faces.get(face);
if (f.isBold() == ft.isBold() && f.isItalic() == ft.isItalic()) {
found = true;
fontFaceSelection.setSelectedItem(face);
break;
}
}
if (!found) {
fontFaceSelection.setSelectedItem("");
}
}
setAllowSave(true);
setEditable(false);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
private static void addTableSpaces(TableLayout tl, double size) {
int cols = tl.getNumColumn();
int rows = tl.getNumRow();
for (int x = 0; x <= cols; x++) {
tl.insertColumn(x * 2, size);
}
for (int y = 0; y <= rows; y++) {
tl.insertRow(y * 2, size);
}
}
jScrollPane1 = new javax.swing.JScrollPane();
jPanel2 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
javax.swing.JLabel jLabel1 = new javax.swing.JLabel();
private void initComponents() {
addCharsPanel = new javax.swing.JPanel();
fontParamsPanel = new javax.swing.JPanel();
fontNameLabel = new javax.swing.JLabel();
javax.swing.JLabel jLabel2 = new javax.swing.JLabel();
javax.swing.JScrollPane fontDisplayNameScrollPane = new javax.swing.JScrollPane();
fontDisplayNameTextArea = new javax.swing.JTextArea();
javax.swing.JLabel jLabel3 = new javax.swing.JLabel();
@@ -232,58 +269,44 @@ public class FontPanel extends javax.swing.JPanel {
javax.swing.JLabel jLabel9 = new javax.swing.JLabel();
fontCharactersScrollPane = new javax.swing.JScrollPane();
fontCharactersTextArea = new javax.swing.JTextArea();
javax.swing.JLabel jLabel10 = new javax.swing.JLabel();
javax.swing.JLabel fontCharsAddLabel = new javax.swing.JLabel();
fontAddCharactersField = new javax.swing.JTextField();
fontAddCharsButton = new javax.swing.JButton();
updateTextsCheckBox = new javax.swing.JCheckBox();
jLabel11 = new javax.swing.JLabel();
fontSelection = new javax.swing.JComboBox();
fontSourceLabel = new javax.swing.JLabel();
fontFamilyNameSelection = new javax.swing.JComboBox<>();
fontFaceSelection = new javax.swing.JComboBox<>();
fontEmbedButton = new javax.swing.JButton();
buttonEdit = new javax.swing.JButton();
buttonSave = new javax.swing.JButton();
buttonCancel = new javax.swing.JButton();
buttonPreviewFont = new javax.swing.JButton();
importTTFButton = new javax.swing.JButton();
addComponentListener(new java.awt.event.ComponentAdapter() {
@Override
public void componentResized(java.awt.event.ComponentEvent evt) {
formComponentResized(evt);
}
});
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
TableLayout tlFontParamsPanel;
fontParamsPanel.setLayout(tlFontParamsPanel = new TableLayout(new double[][]{
{TableLayout.PREFERRED, TableLayout.FILL},
{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,}
}));
jPanel1.setLayout(new java.awt.GridBagLayout());
JLabel fontNameLabLabel = new JLabel();
fontNameLabLabel.setText(AppStrings.translate("font.name")); // NOI18N
fontParamsPanel.add(fontNameLabLabel, "0,0,R");
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("com/jpexs/decompiler/flash/gui/locales/MainFrame"); // NOI18N
jLabel1.setText(bundle.getString("font.name")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weighty = 1.0;
jPanel1.add(jLabel1, gridBagConstraints);
fontNameLabel.setText(bundle.getString("value.unknown")); // NOI18N
fontNameLabel.setText(AppStrings.translate("value.unknown")); // NOI18N
fontNameLabel.setMaximumSize(new java.awt.Dimension(250, 14));
fontNameLabel.setMinimumSize(new java.awt.Dimension(250, 14));
fontNameLabel.setPreferredSize(new java.awt.Dimension(250, 14));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
jPanel1.add(fontNameLabel, gridBagConstraints);
fontParamsPanel.add(fontNameLabel, "1,0");
jLabel2.setText(bundle.getString("fontName.name")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.ipadx = 8;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weighty = 1.0;
jPanel1.add(jLabel2, gridBagConstraints);
JLabel fontNameNameLabLabel = new JLabel();
fontNameNameLabLabel.setText(AppStrings.translate("fontName.name")); // NOI18N
fontParamsPanel.add(fontNameNameLabLabel, "0,1,R");
fontDisplayNameScrollPane.setBorder(null);
fontDisplayNameScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
@@ -293,27 +316,16 @@ public class FontPanel extends javax.swing.JPanel {
fontDisplayNameTextArea.setColumns(20);
fontDisplayNameTextArea.setFont(new JLabel().getFont());
fontDisplayNameTextArea.setLineWrap(true);
fontDisplayNameTextArea.setText(bundle.getString("value.unknown")); // NOI18N
fontDisplayNameTextArea.setText(AppStrings.translate("value.unknown")); // NOI18N
fontDisplayNameTextArea.setWrapStyleWord(true);
fontDisplayNameTextArea.setMinimumSize(new java.awt.Dimension(250, 16));
fontDisplayNameTextArea.setOpaque(false);
fontDisplayNameScrollPane.setViewportView(fontDisplayNameTextArea);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
jPanel1.add(fontDisplayNameScrollPane, gridBagConstraints);
fontParamsPanel.add(fontDisplayNameScrollPane, "1,1");
jLabel3.setText(bundle.getString("fontName.copyright")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weighty = 1.0;
jPanel1.add(jLabel3, gridBagConstraints);
jLabel3.setText(AppStrings.translate("fontName.copyright")); // NOI18N
fontParamsPanel.add(jLabel3, "0,2,R");
fontCopyrightScrollPane.setBorder(null);
fontCopyrightScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
@@ -323,107 +335,48 @@ public class FontPanel extends javax.swing.JPanel {
fontCopyrightTextArea.setColumns(20);
fontCopyrightTextArea.setFont(new JLabel().getFont());
fontCopyrightTextArea.setLineWrap(true);
fontCopyrightTextArea.setText(bundle.getString("value.unknown")); // NOI18N
fontCopyrightTextArea.setText(AppStrings.translate("value.unknown")); // NOI18N
fontCopyrightTextArea.setWrapStyleWord(true);
fontCopyrightTextArea.setMinimumSize(new java.awt.Dimension(250, 16));
fontCopyrightTextArea.setOpaque(false);
fontCopyrightScrollPane.setViewportView(fontCopyrightTextArea);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
jPanel1.add(fontCopyrightScrollPane, gridBagConstraints);
fontParamsPanel.add(fontCopyrightScrollPane, "1,2");
jLabel4.setText(bundle.getString("font.isbold")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weighty = 1.0;
jPanel1.add(jLabel4, gridBagConstraints);
jLabel4.setText(AppStrings.translate("font.isbold")); // NOI18N
fontParamsPanel.add(jLabel4, "0,3,R");
fontIsBoldCheckBox.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
jPanel1.add(fontIsBoldCheckBox, gridBagConstraints);
jLabel5.setText(bundle.getString("font.isitalic")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 4;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weighty = 1.0;
jPanel1.add(jLabel5, gridBagConstraints);
fontParamsPanel.add(fontIsBoldCheckBox, "1,3");
jLabel5.setText(AppStrings.translate("font.isitalic")); // NOI18N
fontParamsPanel.add(jLabel5, "0,4,R");
fontIsItalicCheckBox.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 4;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
jPanel1.add(fontIsItalicCheckBox, gridBagConstraints);
fontParamsPanel.add(fontIsItalicCheckBox, "1,4");
jLabel6.setText(bundle.getString("font.ascent")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 5;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weighty = 1.0;
jPanel1.add(jLabel6, gridBagConstraints);
jLabel6.setText(AppStrings.translate("font.ascent")); // NOI18N
fontParamsPanel.add(jLabel6, "0,5,R");
fontAscentLabel.setText(bundle.getString("value.unknown")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 5;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
jPanel1.add(fontAscentLabel, gridBagConstraints);
fontAscentLabel.setText(AppStrings.translate("value.unknown")); // NOI18N
fontParamsPanel.add(fontAscentLabel, "1,5");
jLabel7.setText(bundle.getString("font.descent")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 6;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weighty = 1.0;
jPanel1.add(jLabel7, gridBagConstraints);
jLabel7.setText(AppStrings.translate("font.descent")); // NOI18N
fontParamsPanel.add(jLabel7, "0,6,R");
fontDescentLabel.setText(bundle.getString("value.unknown")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 6;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
jPanel1.add(fontDescentLabel, gridBagConstraints);
fontDescentLabel.setText(AppStrings.translate("value.unknown")); // NOI18N
fontParamsPanel.add(fontDescentLabel, "1,6");
jLabel8.setText(bundle.getString("font.leading")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 7;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weighty = 1.0;
jPanel1.add(jLabel8, gridBagConstraints);
jLabel8.setText(AppStrings.translate("font.leading")); // NOI18N
fontParamsPanel.add(jLabel8, "0,7,R");
fontLeadingLabel.setText(bundle.getString("value.unknown")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 7;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
jPanel1.add(fontLeadingLabel, gridBagConstraints);
fontLeadingLabel.setText(AppStrings.translate("value.unknown")); // NOI18N
fontParamsPanel.add(fontLeadingLabel, "1,7");
jLabel9.setText(bundle.getString("font.characters")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 8;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.weighty = 1.0;
jPanel1.add(jLabel9, gridBagConstraints);
jLabel9.setText(AppStrings.translate("font.characters")); // NOI18N
fontParamsPanel.add(jLabel9, "0,8,R");
fontCharactersScrollPane.setBorder(null);
fontCharactersScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
@@ -437,173 +390,128 @@ public class FontPanel extends javax.swing.JPanel {
fontCharactersTextArea.setMinimumSize(new java.awt.Dimension(250, 16));
fontCharactersTextArea.setOpaque(false);
fontCharactersScrollPane.setViewportView(fontCharactersTextArea);
fontParamsPanel.add(fontCharactersScrollPane, "1,8");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 8;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
jPanel1.add(fontCharactersScrollPane, gridBagConstraints);
fontCharsAddLabel.setText(AppStrings.translate("font.characters.add")); // NOI18N
jLabel10.setText(bundle.getString("font.characters.add")); // NOI18N
fontAddCharsButton.setText(bundle.getString("button.ok")); // NOI18N
fontAddCharsButton.setText(AppStrings.translate("button.ok")); // NOI18N
fontAddCharsButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
fontAddCharsButtonActionPerformed(evt);
}
});
updateTextsCheckBox.setText(bundle.getString("font.updateTexts")); // NOI18N
updateTextsCheckBox.setText(AppStrings.translate("font.updateTexts")); // NOI18N
jLabel11.setText(bundle.getString("font.source")); // NOI18N
fontSourceLabel.setText(AppStrings.translate("font.source")); // NOI18N
fontSelection.setModel(getModel());
fontSelection.setSelectedItem(FontTag.defaultFontName);
fontSelection.addItemListener(new java.awt.event.ItemListener() {
fontFamilyNameSelection.setModel(getFamilyModel());
fontFamilyNameSelection.setSelectedItem(FontTag.defaultFontName);
fontFaceSelection.setModel(getNameModel((String) fontFamilyNameSelection.getSelectedItem()));
fontFamilyNameSelection.addItemListener(new java.awt.event.ItemListener() {
@Override
public void itemStateChanged(java.awt.event.ItemEvent evt) {
fontSelectionItemStateChanged(evt);
fontFamilySelectionItemStateChanged();
}
});
fontEmbedButton.setText(bundle.getString("button.font.embed")); // NOI18N
fontFaceSelection.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
fontFaceSelectionItemStateChanged();
}
});
fontEmbedButton.setText(AppStrings.translate("button.font.embed")); // NOI18N
fontEmbedButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
fontEmbedButtonActionPerformed(evt);
}
});
buttonEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jpexs/decompiler/flash/gui/graphics/edit16.png"))); // NOI18N
buttonEdit.setText(bundle.getString("button.edit")); // NOI18N
buttonEdit.setText(AppStrings.translate("button.edit")); // NOI18N
buttonEdit.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonEditActionPerformed(evt);
}
});
buttonSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jpexs/decompiler/flash/gui/graphics/save16.png"))); // NOI18N
buttonSave.setText(bundle.getString("button.save")); // NOI18N
buttonSave.setText(AppStrings.translate("button.save")); // NOI18N
buttonSave.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonSaveActionPerformed(evt);
}
});
buttonCancel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jpexs/decompiler/flash/gui/graphics/cancel16.png"))); // NOI18N
buttonCancel.setText(bundle.getString("button.cancel")); // NOI18N
buttonCancel.setText(AppStrings.translate("button.cancel")); // NOI18N
buttonCancel.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonCancelActionPerformed(evt);
}
});
buttonPreviewFont.setText(bundle.getString("button.preview")); // NOI18N
buttonPreviewFont.setText(AppStrings.translate("button.preview")); // NOI18N
buttonPreviewFont.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPreviewFontActionPerformed(evt);
}
});
importTTFButton.setText("Import TTF");
importTTFButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
importTTFButtonActionPerformed(evt);
}
});
TableLayout tlAddCharsPanel;
addCharsPanel.setLayout(tlAddCharsPanel = new TableLayout(new double[][]{
{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED},
{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}
}));
addCharsPanel.setBorder(BorderFactory.createRaisedBevelBorder());
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(importTTFButton)
.addContainerGap(387, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(fontSelection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(fontAddCharactersField, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(fontEmbedButton))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(buttonEdit)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonSave)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonCancel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(fontAddCharsButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(updateTextsCheckBox))
.addComponent(buttonPreviewFont))
.addGap(315, 315, 315)))
.addContainerGap()))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(341, Short.MAX_VALUE)
.addComponent(importTTFButton)
.addGap(85, 85, 85))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(fontAddCharactersField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(fontAddCharsButton)
.addComponent(updateTextsCheckBox))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(fontSelection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonPreviewFont)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(fontEmbedButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 78, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonEdit)
.addComponent(buttonSave)
.addComponent(buttonCancel))
.addContainerGap()))
);
addCharsPanel.add(fontCharsAddLabel, "0,0,R");
addCharsPanel.add(fontAddCharactersField, "1,0,2,0");
addCharsPanel.add(fontAddCharsButton, "3,0");
addCharsPanel.add(fontEmbedButton, "4,0");
jScrollPane1.setViewportView(jPanel2);
addCharsPanel.add(fontSourceLabel, "0,1,R");
addCharsPanel.add(fontFamilyNameSelection, "1,1");
addCharsPanel.add(fontFaceSelection, "2,1");
addCharsPanel.add(buttonPreviewFont, "3,1");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 473, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
addCharsPanel.add(updateTextsCheckBox, "0,2,2,2");
private void fontAddCharsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontAddCharsButtonActionPerformed
JPanel buttonsPanel = new JPanel(new FlowLayout());
buttonsPanel.add(buttonEdit);
buttonsPanel.add(buttonSave);
buttonsPanel.add(buttonCancel);
TableLayout tlAll;
setLayout(tlAll = new TableLayout(new double[][]{
{TableLayout.FILL},
{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}
}));
add(fontParamsPanel, "0,0");
add(buttonsPanel, "0,1");
add(addCharsPanel, "0,2");
addTableSpaces(tlAddCharsPanel, 10);
addTableSpaces(tlFontParamsPanel, 10);
addTableSpaces(tlAll, 10);
}
private void labsize(JLabel lab) {
lab.setPreferredSize(new Dimension(lab.getFontMetrics(lab.getFont()).stringWidth(lab.getText()) + 30, lab.getPreferredSize().height));
lab.setMinimumSize(lab.getPreferredSize());
}
private void fontAddCharsButtonActionPerformed(java.awt.event.ActionEvent evt) {
String newchars = fontAddCharactersField.getText();
TreeItem item = mainPanel.tagTree.getCurrentTreeItem();
@@ -612,47 +520,69 @@ public class FontPanel extends javax.swing.JPanel {
for (int c = 0; c < newchars.length(); c++) {
selChars.add(newchars.codePointAt(c));
}
fontAddChars((FontTag) item, selChars, new Font(fontSelection.getSelectedItem().toString(),Font.PLAIN,12));
fontAddChars((FontTag) item, selChars, FontTag.installedFonts.get(fontFamilyNameSelection.getSelectedItem().toString()).get(fontFaceSelection.getSelectedItem().toString()));
fontAddCharactersField.setText("");
mainPanel.reload(true);
}
}//GEN-LAST:event_fontAddCharsButtonActionPerformed
private void fontEmbedButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontEmbedButtonActionPerformed
}
private void fontEmbedButtonActionPerformed(java.awt.event.ActionEvent evt) {
TreeItem item = mainPanel.tagTree.getCurrentTreeItem();
if (item instanceof FontTag) {
FontTag ft = (FontTag) item;
FontEmbedDialog fed = new FontEmbedDialog(fontSelection.getSelectedItem().toString(), fontAddCharactersField.getText(), ft.getFontStyle());
if (fed.display()) {
FontEmbedDialog fed = new FontEmbedDialog(fontFamilyNameSelection.getSelectedItem().toString(), fontFaceSelection.getSelectedItem().toString(), fontAddCharactersField.getText());
if (fed.display()) {
Set<Integer> selChars = fed.getSelectedChars();
if (!selChars.isEmpty()) {
String selFont = fed.getSelectedFont();
fontSelection.setSelectedItem(selFont);
fontAddChars(ft, selChars, new Font(selFont,Font.PLAIN,10));
fontAddCharactersField.setText("");
mainPanel.reload(true);
Font selFont = fed.getSelectedFont();
updateTextsCheckBox.setSelected(fed.hasUpdateTexts());
fontFamilyNameSelection.setSelectedItem(selFont.getName());
fontFaceSelection.setSelectedItem(FontHelper.getFontFace(selFont));
fontAddChars(ft, selChars, selFont);
fontAddCharactersField.setText("");
mainPanel.reload(true);
}
}
}
}//GEN-LAST:event_fontEmbedButtonActionPerformed
}
private void fontSelectionItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_fontSelectionItemStateChanged
private boolean allowSave = true;
private synchronized void setAllowSave(boolean v) {
allowSave = v;
}
private synchronized void savePair() {
if (!allowSave) {
return;
}
TreeItem item = mainPanel.tagTree.getCurrentTreeItem();
if (item instanceof FontTag) {
FontTag f = (FontTag) item;
SWF swf = f.getSwf();
String selectedSystemFont = (String) fontSelection.getSelectedItem();
swf.sourceFontsMap.put(f.getFontId(), selectedSystemFont);
Configuration.addFontPair(swf.getShortFileName(), f.getFontId(), f.getFontName(), selectedSystemFont);
String selectedFamily = (String) fontFamilyNameSelection.getSelectedItem();
String selectedFace = (String) fontFaceSelection.getSelectedItem();
swf.sourceFontFamiliesMap.put(f.getFontId(), selectedFamily);
swf.sourceFontFacesMap.put(f.getFontId(), selectedFace);
Configuration.addFontPair(swf.getShortFileName(), f.getFontId(), f.getFontName(), selectedFamily, selectedFace);
}
}//GEN-LAST:event_fontSelectionItemStateChanged
}
private void buttonEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEditActionPerformed
private void fontFamilySelectionItemStateChanged() {
savePair();
fontFaceSelection.setModel(getNameModel((String) fontFamilyNameSelection.getSelectedItem()));
}
private void fontFaceSelectionItemStateChanged() {
savePair();
}
private void buttonEditActionPerformed(java.awt.event.ActionEvent evt) {
setEditable(true);
}//GEN-LAST:event_buttonEditActionPerformed
}
private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveActionPerformed
private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {
if (fontTag.isBoldEditable()) {
fontTag.setBold(fontIsBoldCheckBox.isSelected());
}
@@ -660,76 +590,76 @@ public class FontPanel extends javax.swing.JPanel {
fontTag.setItalic(fontIsItalicCheckBox.isSelected());
}
setEditable(false);
}//GEN-LAST:event_buttonSaveActionPerformed
}
private void buttonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCancelActionPerformed
private void buttonCancelActionPerformed(java.awt.event.ActionEvent evt) {
showFontTag(fontTag);
setEditable(false);
}//GEN-LAST:event_buttonCancelActionPerformed
}
private void buttonPreviewFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPreviewFontActionPerformed
String selectedSystemFont = (String) fontSelection.getSelectedItem();
new FontPreviewDialog(null, true, new Font(selectedSystemFont, fontTag.getFontStyle(), 1024)).setVisible(true);
}//GEN-LAST:event_buttonPreviewFontActionPerformed
private void buttonPreviewFontActionPerformed(java.awt.event.ActionEvent evt) {
String familyName = (String) fontFamilyNameSelection.getSelectedItem();
String face = (String) fontFaceSelection.getSelectedItem();
new FontPreviewDialog(null, true, FontTag.installedFonts.get(familyName).get(face)).setVisible(true);
}
private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized
jPanel1.updateUI();
}//GEN-LAST:event_formComponentResized
private void formComponentResized(java.awt.event.ComponentEvent evt) {
fontParamsPanel.updateUI();
}
private void importTTFButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importTTFButtonActionPerformed
private void importTTFButtonActionPerformed(java.awt.event.ActionEvent evt) {
TreeItem item = mainPanel.tagTree.getCurrentTreeItem();
if (item instanceof FontTag) {
FontTag ft = (FontTag) item;
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File(Configuration.lastOpenDir.get()));
FileFilter ttfFilter = new FileFilter() {
@Override
public boolean accept(File f) {
return (f.getName().toLowerCase().endsWith(".ttf")) || (f.isDirectory());
}
FontTag ft = (FontTag) item;
@Override
public String getDescription() {
return "TTF files";
}
};
fc.setFileFilter(ttfFilter);
fc.setAcceptAllFileFilterUsed(false);
JFrame fr = new JFrame();
View.setWindowIcon(fr);
int returnVal = fc.showOpenDialog(fr);
if (returnVal == JFileChooser.APPROVE_OPTION) {
Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath());
File selfile = Helper.fixDialogFile(fc.getSelectedFile());
Set<Integer> selChars = new HashSet<>();
try {
Font f = Font.createFont(Font.TRUETYPE_FONT, selfile);
int required[] = new int[]{0x0001, 0x0000, 0x000D, 0x0020};
loopi:for(char i=0;i<Character.MAX_VALUE;i++){
for(int r:required){
if(r==i){
continue loopi;
}
}
if(f.canDisplay((int)i)){
selChars.add((int)i);
}
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File(Configuration.lastOpenDir.get()));
FileFilter ttfFilter = new FileFilter() {
@Override
public boolean accept(File f) {
return (f.getName().toLowerCase().endsWith(".ttf")) || (f.isDirectory());
}
fontAddChars(ft,selChars, f);
mainPanel.reload(true);
} catch (FontFormatException ex) {
JOptionPane.showMessageDialog(mainPanel, "Invalid TTF font");
} catch (IOException ex) {
Logger.getLogger(FontPanel.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}//GEN-LAST:event_importTTFButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
@Override
public String getDescription() {
return "TTF files";
}
};
fc.setFileFilter(ttfFilter);
fc.setAcceptAllFileFilterUsed(false);
JFrame fr = new JFrame();
View.setWindowIcon(fr);
int returnVal = fc.showOpenDialog(fr);
if (returnVal == JFileChooser.APPROVE_OPTION) {
Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath());
File selfile = Helper.fixDialogFile(fc.getSelectedFile());
Set<Integer> selChars = new HashSet<>();
try {
Font f = Font.createFont(Font.TRUETYPE_FONT, selfile);
int required[] = new int[]{0x0001, 0x0000, 0x000D, 0x0020};
loopi:
for (char i = 0; i < Character.MAX_VALUE; i++) {
for (int r : required) {
if (r == i) {
continue loopi;
}
}
if (f.canDisplay((int) i)) {
selChars.add((int) i);
}
}
fontAddChars(ft, selChars, f);
mainPanel.reload(true);
} catch (FontFormatException ex) {
JOptionPane.showMessageDialog(mainPanel, "Invalid TTF font");
} catch (IOException ex) {
Logger.getLogger(FontPanel.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
private javax.swing.JButton buttonCancel;
private javax.swing.JButton buttonEdit;
private javax.swing.JButton buttonPreviewFont;
@@ -747,12 +677,11 @@ public class FontPanel extends javax.swing.JPanel {
private javax.swing.JCheckBox fontIsItalicCheckBox;
private javax.swing.JLabel fontLeadingLabel;
private javax.swing.JLabel fontNameLabel;
private javax.swing.JComboBox fontSelection;
private javax.swing.JButton importTTFButton;
private javax.swing.JLabel jLabel11;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JComboBox<String> fontFamilyNameSelection;
private javax.swing.JComboBox<String> fontFaceSelection;
private javax.swing.JLabel fontSourceLabel;
private javax.swing.JPanel fontParamsPanel;
private javax.swing.JPanel addCharsPanel;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JCheckBox updateTextsCheckBox;
// End of variables declaration//GEN-END:variables
}

View File

@@ -48,13 +48,13 @@ public class FontPreviewDialog extends AppDialog {
initComponents();
View.setWindowIcon(this);
labelSample12.setFont(font.deriveFont(Font.PLAIN, 12));
labelSample18.setFont(font.deriveFont(Font.PLAIN, 18));
labelSample24.setFont(font.deriveFont(Font.PLAIN, 24));
labelSample36.setFont(font.deriveFont(Font.PLAIN, 36));
labelSample48.setFont(font.deriveFont(Font.PLAIN, 48));
labelSample60.setFont(font.deriveFont(Font.PLAIN, 60));
labelSample72.setFont(font.deriveFont(Font.PLAIN, 72));
labelSample12.setFont(font.deriveFont(12f));
labelSample18.setFont(font.deriveFont(18f));
labelSample24.setFont(font.deriveFont(24f));
labelSample36.setFont(font.deriveFont(36f));
labelSample48.setFont(font.deriveFont(48f));
labelSample60.setFont(font.deriveFont(60f));
labelSample72.setFont(font.deriveFont(72f));
comboBoxSampleTexts.setSelectedIndex(Configuration.guiFontPreviewSampleText.get(0));
if (Configuration.guiFontPreviewWidth.hasValue()) {
int width = Configuration.guiFontPreviewWidth.get();

View File

@@ -1906,11 +1906,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
if (textTag.setFormattedText(new MissingCharacterHandler() {
@Override
public boolean handle(FontTag font, char character) {
String fontName = font.getSwf().sourceFontsMap.get(font.getFontId());
String fontName = font.getSwf().sourceFontFamiliesMap.get(font.getFontId());
if (fontName == null) {
fontName = font.getFontName();
}
fontName = FontTag.findInstalledFontName(fontName);
fontName = FontTag.findInstalledFontFamily(fontName);
Font f = new Font(fontName, font.getFontStyle(), 18);
if (!f.canDisplay(character)) {
View.showMessageDialog(null, translate("error.font.nocharacter").replace("%char%", "" + character), translate("error"), JOptionPane.ERROR_MESSAGE);

View File

@@ -16,3 +16,11 @@
range.description = %name% (%available% of %total% characters)
dialog.title = Font embedding
label.individual = Individual characters:
button.loadfont = Load font from disk...
filter.ttf = True Type Font files (*.ttf)
error.invalidfontfile = Invalid font file
error.cannotreadfontfile = Cannot read font file
installed = Installed:
ttffile.noselection = TTF file: <select>
ttffile.selection = TTF file: %fontname% (%filename%)
allcharacters = All characters (%available% characters)

View File

@@ -16,3 +16,11 @@
range.description = %name% (%available% z %total% znak\u016f)
dialog.title = Vlo\u017een\u00ed p\u00edsma
label.individual = Individu\u00e1ln\u00ed znaky:
button.loadfont = Na\u010d\u00edst p\u00edsmo z disku...
filter.ttf = Soubory p\u00edsma True Type (*.ttf)
error.invalidfontfile = Neplatn\u00fd soubor p\u00edsma
error.cannotreadfontfile = Nelze na\u010d\u00edst soubor p\u00edsma
installed = Nainstalov\u00e1no:
ttffile.noselection = TTF soubor: <select>
ttffile.selection = TTF soubor: %fontname% (%filename%)
allcharacters = V\u0161echny znaky (%available% znak\u016f)