From 55ec21b4df51e80cbf71785a3cee30a8116d19f1 Mon Sep 17 00:00:00 2001 From: David Schweinsberg Date: Wed, 30 Dec 2015 11:48:23 -0800 Subject: Shifted methods from CffTable into CffFont --- .../dev/typecast/app/editor/TableTreeBuilder.java | 25 ++++++++-------------- src/net/java/dev/typecast/cff/CffFont.java | 8 +++++-- src/net/java/dev/typecast/ot/table/CffTable.java | 12 ----------- 3 files changed, 15 insertions(+), 30 deletions(-) diff --git a/src/net/java/dev/typecast/app/editor/TableTreeBuilder.java b/src/net/java/dev/typecast/app/editor/TableTreeBuilder.java index 6fc7519..0764466 100644 --- a/src/net/java/dev/typecast/app/editor/TableTreeBuilder.java +++ b/src/net/java/dev/typecast/app/editor/TableTreeBuilder.java @@ -1,9 +1,7 @@ /* - * $Id: TableTreeBuilder.java,v 1.2 2007-02-08 04:28:30 davidsch Exp $ - * * Typecast - The Font Development Environment * - * Copyright (c) 2004-2007 David Schweinsberg + * Copyright (c) 2004-2015 David Schweinsberg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,14 +18,14 @@ package net.java.dev.typecast.app.editor; -import java.util.Enumeration; - import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeModel; - +import net.java.dev.typecast.cff.CffFont; +import net.java.dev.typecast.cff.Charstring; +import net.java.dev.typecast.cff.NameIndex; import net.java.dev.typecast.ot.OTFont; import net.java.dev.typecast.ot.OTFontCollection; - +import net.java.dev.typecast.ot.table.CffTable; import net.java.dev.typecast.ot.table.CmapIndexEntry; import net.java.dev.typecast.ot.table.CmapTable; import net.java.dev.typecast.ot.table.DirectoryEntry; @@ -36,14 +34,11 @@ import net.java.dev.typecast.ot.table.GlyfCompositeComp; import net.java.dev.typecast.ot.table.GlyfCompositeDescript; import net.java.dev.typecast.ot.table.GlyfDescript; import net.java.dev.typecast.ot.table.GlyfTable; -import net.java.dev.typecast.ot.table.CffTable; -import net.java.dev.typecast.cff.Charstring; import net.java.dev.typecast.ot.table.GsubTable; import net.java.dev.typecast.ot.table.ID; import net.java.dev.typecast.ot.table.LangSys; import net.java.dev.typecast.ot.table.Lookup; import net.java.dev.typecast.ot.table.LookupSubtable; -import net.java.dev.typecast.cff.NameIndex; import net.java.dev.typecast.ot.table.NameRecord; import net.java.dev.typecast.ot.table.NameTable; import net.java.dev.typecast.ot.table.PostTable; @@ -52,7 +47,6 @@ import net.java.dev.typecast.ot.table.Table; /** * @author David Schweinsberg - * @version $Id: TableTreeBuilder.java,v 1.2 2007-02-08 04:28:30 davidsch Exp $ */ public class TableTreeBuilder { @@ -229,10 +223,9 @@ public class TableTreeBuilder { private static void addCffFont( OTFont font, TableTreeNode parent, - CffTable ct, - int fontIndex) { - for (int i = 0; i < ct.getCharstringCount(fontIndex); ++i) { - Charstring cs = ct.getCharstring(fontIndex, i); + CffFont cf) { + for (int i = 0; i < cf.getCharstringCount(); ++i) { + Charstring cs = cf.getCharstring(i); TableTreeNode n = new TableTreeNode( String.valueOf(i) + " " + cs.getName(), cs, @@ -249,7 +242,7 @@ public class TableTreeBuilder { ni, i); parent.add(n); - addCffFont(font, n, ct, i); + addCffFont(font, n, ct.getFont(i)); } } diff --git a/src/net/java/dev/typecast/cff/CffFont.java b/src/net/java/dev/typecast/cff/CffFont.java index 1231a34..574ccdd 100644 --- a/src/net/java/dev/typecast/cff/CffFont.java +++ b/src/net/java/dev/typecast/cff/CffFont.java @@ -58,7 +58,11 @@ public class CffFont { return _charset; } - public Charstring[] getCharstrings() { - return _charstrings; + public Charstring getCharstring(int gid) { + return _charstrings[gid]; + } + + public int getCharstringCount() { + return _charstrings.length; } } diff --git a/src/net/java/dev/typecast/ot/table/CffTable.java b/src/net/java/dev/typecast/ot/table/CffTable.java index 9739381..523eda6 100644 --- a/src/net/java/dev/typecast/ot/table/CffTable.java +++ b/src/net/java/dev/typecast/ot/table/CffTable.java @@ -176,18 +176,6 @@ public class CffTable implements Table { return _fonts[fontIndex]; } -// public Charset getCharset(int fontIndex) { -// return _charsets[fontIndex]; -// } - - public Charstring getCharstring(int fontIndex, int gid) { - return _fonts[fontIndex].getCharstrings()[gid]; - } - - public int getCharstringCount(int fontIndex) { - return _fonts[fontIndex].getCharstrings().length; - } - @Override public int getType() { return CFF; -- cgit v1.2.3