public void showFontTag(FontTag ft) { SWF swf = ft.getSwf(); fontTag = ft; fontNameIntagLabel.setText(ft.getFontNameIntag()); fontNameTextArea.setText(ft.getFontName()); fontCopyrightTextArea.setText(ft.getFontCopyright()); fontIsBoldCheckBox.setSelected(ft.isBold()); fontIsItalicCheckBox.setSelected(ft.isItalic()); fontDescentLabel.setText( ft.getDescent() == -1 ? translate("value.unknown") : Integer.toString(ft.getDescent())); fontAscentLabel.setText( ft.getAscent() == -1 ? translate("value.unknown") : Integer.toString(ft.getAscent())); fontLeadingLabel.setText( ft.getLeading() == -1 ? translate("value.unknown") : Integer.toString(ft.getLeading())); String chars = ft.getCharacters(); fontCharactersTextArea.setText(chars); fontCharactersScrollPane.getVerticalScrollBar().scrollRectToVisible(new Rectangle(0, 0, 1, 1)); setAllowSave(false); Font selFont = ft.getSystemFont(); fontFamilyNameSelection.setSelectedItem(new FontFamily(selFont)); fontFaceSelection.setSelectedItem(new FontFace(selFont)); setAllowSave(true); setEditable(false); }
private void nextFontsButtonActionPerformed(ActionEvent evt) { FontTag fontTag = fontPanel.getFontTag(); int pageCount = getFontPageCount(fontTag); fontPageNum = (fontPageNum + 1) % pageCount; if (mainPanel.isInternalFlashViewerSelected() /*|| ft instanceof GFxDefineCompactedFont*/) { imagePanel.setTimelined(MainPanel.makeTimelined(fontTag, fontPageNum), fontTag.getSwf(), 0); } }
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 selectedName = ((FontFace) fontFaceSelection.getSelectedItem()).font.getFontName(Locale.ENGLISH); swf.sourceFontNamesMap.put(f.getFontId(), selectedName); Configuration.addFontPair( swf.getShortFileName(), f.getFontId(), f.getFontNameIntag(), selectedName); } }
private void fontAddChars(FontTag ft, Set<Integer> selChars, Font font) { FontTag f = (FontTag) mainPanel.tagTree.getCurrentTreeItem(); String oldchars = f.getCharacters(); for (int ic : selChars) { char c = (char) ic; if (oldchars.indexOf((int) c) == -1) { font = font.deriveFont(f.getFontStyle(), 1024); if (!font.canDisplay(c)) { String msg = translate("error.font.nocharacter").replace("%char%", "" + c); Logger.getLogger(FontPanel.class.getName()).log(Level.SEVERE, msg); View.showMessageDialog(null, msg, translate("error"), JOptionPane.ERROR_MESSAGE); return; } } } String[] yesno = new String[] { translate("button.yes"), translate("button.no"), translate("button.yes.all"), translate("button.no.all") }; boolean yestoall = false; boolean notoall = false; for (int ic : selChars) { char c = (char) ic; if (oldchars.indexOf((int) c) > -1) { int opt = -1; 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) { yestoall = true; } if (opt == 3) { notoall = true; } } if (yestoall) { opt = 0; // yes } else if (notoall) { opt = 1; // no } if (opt == 1) { continue; } } f.addCharacter(c, font); oldchars += c; } int fontId = ft.getFontId(); if (updateTextsCheckBox.isSelected()) { SWF swf = ft.getSwf(); for (Tag tag : swf.getTags()) { if (tag instanceof TextTag) { TextTag textTag = (TextTag) tag; if (textTag.getFontIds().contains(fontId)) { String text = textTag.getFormattedText().text; mainPanel.saveText(textTag, text, null); } } } } ft.setModified(true); ft.getSwf().clearImageCache(); }
private void showFontPage(FontTag fontTag) { if (mainPanel.isInternalFlashViewerSelected() /*|| ft instanceof GFxDefineCompactedFont*/) { showImagePanel(MainPanel.makeTimelined(fontTag), fontTag.getSwf(), fontPageNum); } }