mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-01 10:55:12 +00:00
warnings fixed in ttf project + removed SuppressWarnings
This commit is contained in:
BIN
lib/ttf.jar
BIN
lib/ttf.jar
Binary file not shown.
@@ -153,7 +153,7 @@ public class FontExporter {
|
||||
if (ascent != -1) {
|
||||
f.setAscender(Math.round(ascent / divider));
|
||||
}
|
||||
|
||||
|
||||
int descent = t.getDescent();
|
||||
if (descent != -1) {
|
||||
f.setDescender(Math.round(descent / divider));
|
||||
@@ -247,7 +247,7 @@ public class FontExporter {
|
||||
|
||||
if (mode == FontExportMode.WOFF) {
|
||||
FontFactory fontFactory = FontFactory.getInstance();
|
||||
byte[] fontBytes = new byte[0];
|
||||
byte[] fontBytes;
|
||||
try (FileInputStream fis = new FileInputStream(ttfFile)) {
|
||||
fontBytes = new byte[(int) ttfFile.length()];
|
||||
fis.read(fontBytes);
|
||||
|
||||
@@ -1,316 +1,315 @@
|
||||
/*
|
||||
* $Id: CmapWriter.java,v 1.8 2004/01/27 00:35:08 eed3si9n Exp $
|
||||
*
|
||||
* $Copyright: copyright (c) 2003, e.e d3si9n $
|
||||
* $License:
|
||||
* This source code is part of DoubleType.
|
||||
* DoubleType is a graphical typeface designer.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This Program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, e.e d3si9n gives permission to
|
||||
* link the code of this program with any Java Platform that is available
|
||||
* to public with free of charge, including but not limited to
|
||||
* Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE),
|
||||
* and distribute linked combinations including the two.
|
||||
* You must obey the GNU General Public License in all respects for all
|
||||
* of the code used other than Java Platform. If you modify this file,
|
||||
* you may extend this exception to your version of the file, but you are not
|
||||
* obligated to do so. If you do not wish to do so, delete this exception
|
||||
* statement from your version.
|
||||
* $
|
||||
*/
|
||||
|
||||
package org.doubletype.ossa.truetype;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author e.e
|
||||
*/
|
||||
public class CmapWriter extends FontFormatWriter {
|
||||
final long k_basicLatinStart = 0x20;
|
||||
final long k_basicLatinEnd = 0x7e;
|
||||
final long k_tableEnd = 0xffff;
|
||||
final int k_unmappedChar = 0x0;
|
||||
|
||||
private OS2Writer m_os2;
|
||||
private List<Long> m_unicodes = new ArrayList<>();
|
||||
private List<Long> m_startCodes = new ArrayList<>();
|
||||
private List<Long> m_endCodes = new ArrayList<>();
|
||||
private Hashtable<Long, Long> m_unicode2glyph = new Hashtable<>();
|
||||
private List<TTUnicodeRange> m_unicodeRanges = new ArrayList<>();
|
||||
private List<Long> m_idDeltas = new ArrayList<>();
|
||||
private List<Long> m_idRangeOffsets = new ArrayList<>();
|
||||
private boolean m_isIncludeVersion0;
|
||||
private byte [] m_version0;
|
||||
private byte [] m_version4;
|
||||
private byte [] m_version12;
|
||||
|
||||
public CmapWriter(OS2Writer a_os2) {
|
||||
super();
|
||||
|
||||
m_os2 = a_os2;
|
||||
m_isIncludeVersion0 = false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void prepare() {
|
||||
Collections.sort(m_unicodeRanges);
|
||||
|
||||
TTUnicodeRange range = (TTUnicodeRange) m_unicodeRanges.get(0);
|
||||
m_os2.m_usFirstCharIndex = (int) range.getStartCode();
|
||||
m_os2.m_usLastCharIndex = (int) range.getEndCode();
|
||||
|
||||
int i;
|
||||
for (i = 0; i < m_unicodeRanges.size(); i++) {
|
||||
range = m_unicodeRanges.get(i);
|
||||
|
||||
m_startCodes.add(range.getStartCode());
|
||||
m_endCodes.add(range.getEndCode());
|
||||
m_idDeltas.add(0L);
|
||||
m_idRangeOffsets.add(
|
||||
2L * (m_unicodeRanges.size() - i) + 2L
|
||||
+ 2L * (m_unicodes.size()));
|
||||
|
||||
m_os2.m_usLastCharIndex = (int) range.getEndCode();
|
||||
m_os2.setUnicodeRangeFlag(range.getOsTwoFlag());
|
||||
|
||||
for (long unicode = range.getStartCode();
|
||||
unicode <= range.getEndCode(); unicode++)
|
||||
{
|
||||
m_unicodes.add(unicode);
|
||||
} // for unicode
|
||||
} // for i
|
||||
|
||||
m_startCodes.add(k_tableEnd);
|
||||
m_endCodes.add(k_tableEnd);
|
||||
m_idDeltas.add(1L);
|
||||
m_idRangeOffsets.add(0L);
|
||||
}
|
||||
|
||||
public void write() throws IOException {
|
||||
prepare();
|
||||
|
||||
if (m_isIncludeVersion0) {
|
||||
storeVersion0();
|
||||
} // if
|
||||
storeVersion4();
|
||||
|
||||
reset();
|
||||
|
||||
writeUInt16(0); // table version number
|
||||
writeUInt16(getNumOfEncoding()); // num of encodings
|
||||
|
||||
if (m_isIncludeVersion0) {
|
||||
writeUInt16(TTName.k_macintosh);
|
||||
writeUInt16(TTName.k_macRomanEncode);
|
||||
writeUInt32(size() + 4 + 8);
|
||||
} // if
|
||||
|
||||
writeUInt16(TTName.k_microsoft);
|
||||
writeUInt16(TTName.k_winUnicodeEncode);
|
||||
int version4Offset = size() + 4;
|
||||
if (m_isIncludeVersion0) {
|
||||
version4Offset += m_version0.length;
|
||||
} // if
|
||||
writeUInt32(version4Offset);
|
||||
|
||||
if (m_isIncludeVersion0) {
|
||||
m_buffer.write(m_version0);
|
||||
} // if
|
||||
|
||||
m_buffer.write(m_version4);
|
||||
pad();
|
||||
}
|
||||
|
||||
private int getNumOfEncoding() {
|
||||
if (m_isIncludeVersion0) {
|
||||
return 2;
|
||||
} // if
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void addUnicodeRange(TTUnicodeRange a_range) {
|
||||
m_unicodeRanges.add(a_range);
|
||||
}
|
||||
|
||||
public void addMapping(long a_unicode, long a_glyfIndex) {
|
||||
m_unicode2glyph.put(a_unicode, a_glyfIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find 'glyf' index for the given unicode.
|
||||
* This method returns 0, if a_key was not found, which will be treated
|
||||
* as unmapped character.
|
||||
* @param a_key Long object with unicode value.
|
||||
* @return 'glyf' index if a_key was found; 0 otherwise.
|
||||
*/
|
||||
public long getGlyfIndex(Long a_key) {
|
||||
long retval = 0;
|
||||
|
||||
if (m_unicode2glyph.containsKey(a_key)) {
|
||||
retval = m_unicode2glyph.get(a_key);
|
||||
} // if
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
private void storeVersion0() throws IOException {
|
||||
reset();
|
||||
writeVersion0();
|
||||
m_version0 = toByteArray();
|
||||
reset();
|
||||
}
|
||||
|
||||
private void storeVersion4() throws IOException {
|
||||
reset();
|
||||
writeVersion4();
|
||||
m_version4 = toByteArray();
|
||||
reset();
|
||||
}
|
||||
|
||||
private void storeVersion12() throws IOException {
|
||||
reset();
|
||||
writeVersion12();
|
||||
m_version12 = toByteArray();
|
||||
reset();
|
||||
}
|
||||
|
||||
protected String getTag() {
|
||||
return "cmap";
|
||||
}
|
||||
|
||||
private void writeVersion0() throws IOException {
|
||||
writeUInt16(0);
|
||||
writeUInt16(262);
|
||||
writeUInt16(0);
|
||||
int i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
if ((i == 0x000) || (i == 0x0008) || (i == 0x001D)) {
|
||||
writeUInt8((int) getGlyfIndex(TTUnicodeRange.k_null)); // .null
|
||||
}
|
||||
else if ((i == 0x0009) || (i == 0x000d)) {
|
||||
writeUInt8((int) getGlyfIndex(TTUnicodeRange.k_cr)); // CR
|
||||
}
|
||||
else {
|
||||
writeUInt8((int) getGlyfIndex((long) i));
|
||||
} // if
|
||||
} // for i
|
||||
}
|
||||
|
||||
private void writeVersion4() throws IOException {
|
||||
int segCount = m_startCodes.size();
|
||||
int i;
|
||||
|
||||
// endCount
|
||||
for (i = 0; i < segCount; i++) {
|
||||
Long n = (Long) m_endCodes.get(i);
|
||||
writeUInt16(n.intValue());
|
||||
} // for i
|
||||
|
||||
// reserverdPad
|
||||
writeUInt16(0);
|
||||
|
||||
// startCount
|
||||
for (i = 0; i < segCount; i++) {
|
||||
Long n = m_startCodes.get(i);
|
||||
writeUInt16(n.intValue());
|
||||
} // for i
|
||||
|
||||
// idDelta
|
||||
for (i = 0; i < segCount; i++) {
|
||||
Long n = m_idDeltas.get(i);
|
||||
writeInt16(n.intValue());
|
||||
} // for i
|
||||
|
||||
// idRangeOffset
|
||||
for (i = 0; i < segCount; i++) {
|
||||
Long n = m_idRangeOffsets.get(i);
|
||||
writeInt16(n.intValue());
|
||||
}
|
||||
|
||||
// glyphIdArray 2 bytes each
|
||||
for (i = 0; i < m_unicodes.size(); i++) {
|
||||
Long unicode = m_unicodes.get(i);
|
||||
writeUInt16((int) getGlyfIndex(unicode));
|
||||
} // for i
|
||||
|
||||
byte [] bytes = m_bytes.toByteArray();
|
||||
|
||||
reset();
|
||||
|
||||
writeUInt16(4);
|
||||
writeUInt16(bytes.length + 14);
|
||||
writeUInt16(0);
|
||||
writeUInt16(segCount * 2);
|
||||
|
||||
int searchRange = getSearchRange(segCount);
|
||||
writeUInt16(searchRange);
|
||||
writeUInt16(getEntrySelector(searchRange));
|
||||
writeUInt16(getRangeShift(segCount, searchRange));
|
||||
m_buffer.write(bytes);
|
||||
}
|
||||
|
||||
public void writeVersion12() throws IOException {
|
||||
ArrayList<Long> startCharCode = new ArrayList<>();
|
||||
ArrayList<Long> endCharCode = new ArrayList<>();
|
||||
ArrayList<Long> startGlyphCode = new ArrayList<>();
|
||||
|
||||
// TODO: map to real one
|
||||
startCharCode.add(k_basicLatinStart);
|
||||
endCharCode.add(k_basicLatinEnd);
|
||||
startGlyphCode.add(1L);
|
||||
|
||||
long length = 16 + 12 * startCharCode.size();
|
||||
|
||||
writeFixed32(12.0);
|
||||
writeUInt32(length);
|
||||
writeUInt32(0);
|
||||
writeUInt32(startCharCode.size());
|
||||
|
||||
int i;
|
||||
for (i = 0; i < startCharCode.size(); i++) {
|
||||
writeUInt32(startCharCode.get(i));
|
||||
writeUInt32(endCharCode.get(i));
|
||||
writeUInt32(startGlyphCode.get(i));
|
||||
} // for i
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for searchRange
|
||||
* @param a_value
|
||||
* @return
|
||||
*/
|
||||
private int getSearchRange(int a_value) {
|
||||
int retval
|
||||
= (int) Math.pow(2, Math.floor(Math.log(a_value) / Math.log(2)));
|
||||
return 2 * retval;
|
||||
}
|
||||
|
||||
private int getEntrySelector(int a_searchRange) {
|
||||
int retval
|
||||
= (int) (Math.log(a_searchRange / 2) / Math.log(2));
|
||||
return retval;
|
||||
}
|
||||
|
||||
private int getRangeShift(int a_value, int a_searchRange) {
|
||||
int retval
|
||||
= 2 * a_value - a_searchRange;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* $Id: CmapWriter.java,v 1.8 2004/01/27 00:35:08 eed3si9n Exp $
|
||||
*
|
||||
* $Copyright: copyright (c) 2003, e.e d3si9n $
|
||||
* $License:
|
||||
* This source code is part of DoubleType.
|
||||
* DoubleType is a graphical typeface designer.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This Program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, e.e d3si9n gives permission to
|
||||
* link the code of this program with any Java Platform that is available
|
||||
* to public with free of charge, including but not limited to
|
||||
* Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE),
|
||||
* and distribute linked combinations including the two.
|
||||
* You must obey the GNU General Public License in all respects for all
|
||||
* of the code used other than Java Platform. If you modify this file,
|
||||
* you may extend this exception to your version of the file, but you are not
|
||||
* obligated to do so. If you do not wish to do so, delete this exception
|
||||
* statement from your version.
|
||||
* $
|
||||
*/
|
||||
|
||||
package org.doubletype.ossa.truetype;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author e.e
|
||||
*/
|
||||
public class CmapWriter extends FontFormatWriter {
|
||||
final long k_basicLatinStart = 0x20;
|
||||
final long k_basicLatinEnd = 0x7e;
|
||||
final long k_tableEnd = 0xffff;
|
||||
final int k_unmappedChar = 0x0;
|
||||
|
||||
private OS2Writer m_os2;
|
||||
private List<Long> m_unicodes = new ArrayList<>();
|
||||
private List<Long> m_startCodes = new ArrayList<>();
|
||||
private List<Long> m_endCodes = new ArrayList<>();
|
||||
private Hashtable<Long, Long> m_unicode2glyph = new Hashtable<>();
|
||||
private List<TTUnicodeRange> m_unicodeRanges = new ArrayList<>();
|
||||
private List<Long> m_idDeltas = new ArrayList<>();
|
||||
private List<Long> m_idRangeOffsets = new ArrayList<>();
|
||||
private boolean m_isIncludeVersion0;
|
||||
private byte [] m_version0;
|
||||
private byte [] m_version4;
|
||||
private byte [] m_version12;
|
||||
|
||||
public CmapWriter(OS2Writer a_os2) {
|
||||
super();
|
||||
|
||||
m_os2 = a_os2;
|
||||
m_isIncludeVersion0 = false;
|
||||
}
|
||||
|
||||
private void prepare() {
|
||||
Collections.sort(m_unicodeRanges);
|
||||
|
||||
TTUnicodeRange range = (TTUnicodeRange) m_unicodeRanges.get(0);
|
||||
m_os2.m_usFirstCharIndex = (int) range.getStartCode();
|
||||
m_os2.m_usLastCharIndex = (int) range.getEndCode();
|
||||
|
||||
int i;
|
||||
for (i = 0; i < m_unicodeRanges.size(); i++) {
|
||||
range = m_unicodeRanges.get(i);
|
||||
|
||||
m_startCodes.add(range.getStartCode());
|
||||
m_endCodes.add(range.getEndCode());
|
||||
m_idDeltas.add(0L);
|
||||
m_idRangeOffsets.add(
|
||||
2L * (m_unicodeRanges.size() - i) + 2L
|
||||
+ 2L * (m_unicodes.size()));
|
||||
|
||||
m_os2.m_usLastCharIndex = (int) range.getEndCode();
|
||||
m_os2.setUnicodeRangeFlag(range.getOsTwoFlag());
|
||||
|
||||
for (long unicode = range.getStartCode();
|
||||
unicode <= range.getEndCode(); unicode++)
|
||||
{
|
||||
m_unicodes.add(unicode);
|
||||
} // for unicode
|
||||
} // for i
|
||||
|
||||
m_startCodes.add(k_tableEnd);
|
||||
m_endCodes.add(k_tableEnd);
|
||||
m_idDeltas.add(1L);
|
||||
m_idRangeOffsets.add(0L);
|
||||
}
|
||||
|
||||
public void write() throws IOException {
|
||||
prepare();
|
||||
|
||||
if (m_isIncludeVersion0) {
|
||||
storeVersion0();
|
||||
} // if
|
||||
storeVersion4();
|
||||
|
||||
reset();
|
||||
|
||||
writeUInt16(0); // table version number
|
||||
writeUInt16(getNumOfEncoding()); // num of encodings
|
||||
|
||||
if (m_isIncludeVersion0) {
|
||||
writeUInt16(TTName.k_macintosh);
|
||||
writeUInt16(TTName.k_macRomanEncode);
|
||||
writeUInt32(size() + 4 + 8);
|
||||
} // if
|
||||
|
||||
writeUInt16(TTName.k_microsoft);
|
||||
writeUInt16(TTName.k_winUnicodeEncode);
|
||||
int version4Offset = size() + 4;
|
||||
if (m_isIncludeVersion0) {
|
||||
version4Offset += m_version0.length;
|
||||
} // if
|
||||
writeUInt32(version4Offset);
|
||||
|
||||
if (m_isIncludeVersion0) {
|
||||
m_buffer.write(m_version0);
|
||||
} // if
|
||||
|
||||
m_buffer.write(m_version4);
|
||||
pad();
|
||||
}
|
||||
|
||||
private int getNumOfEncoding() {
|
||||
if (m_isIncludeVersion0) {
|
||||
return 2;
|
||||
} // if
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void addUnicodeRange(TTUnicodeRange a_range) {
|
||||
m_unicodeRanges.add(a_range);
|
||||
}
|
||||
|
||||
public void addMapping(long a_unicode, long a_glyfIndex) {
|
||||
m_unicode2glyph.put(a_unicode, a_glyfIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find 'glyf' index for the given unicode.
|
||||
* This method returns 0, if a_key was not found, which will be treated
|
||||
* as unmapped character.
|
||||
* @param a_key Long object with unicode value.
|
||||
* @return 'glyf' index if a_key was found; 0 otherwise.
|
||||
*/
|
||||
public long getGlyfIndex(Long a_key) {
|
||||
long retval = 0;
|
||||
|
||||
if (m_unicode2glyph.containsKey(a_key)) {
|
||||
retval = m_unicode2glyph.get(a_key);
|
||||
} // if
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
private void storeVersion0() throws IOException {
|
||||
reset();
|
||||
writeVersion0();
|
||||
m_version0 = toByteArray();
|
||||
reset();
|
||||
}
|
||||
|
||||
private void storeVersion4() throws IOException {
|
||||
reset();
|
||||
writeVersion4();
|
||||
m_version4 = toByteArray();
|
||||
reset();
|
||||
}
|
||||
|
||||
private void storeVersion12() throws IOException {
|
||||
reset();
|
||||
writeVersion12();
|
||||
m_version12 = toByteArray();
|
||||
reset();
|
||||
}
|
||||
|
||||
protected String getTag() {
|
||||
return "cmap";
|
||||
}
|
||||
|
||||
private void writeVersion0() throws IOException {
|
||||
writeUInt16(0);
|
||||
writeUInt16(262);
|
||||
writeUInt16(0);
|
||||
int i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
if ((i == 0x000) || (i == 0x0008) || (i == 0x001D)) {
|
||||
writeUInt8((int) getGlyfIndex(TTUnicodeRange.k_null)); // .null
|
||||
}
|
||||
else if ((i == 0x0009) || (i == 0x000d)) {
|
||||
writeUInt8((int) getGlyfIndex(TTUnicodeRange.k_cr)); // CR
|
||||
}
|
||||
else {
|
||||
writeUInt8((int) getGlyfIndex((long) i));
|
||||
} // if
|
||||
} // for i
|
||||
}
|
||||
|
||||
private void writeVersion4() throws IOException {
|
||||
int segCount = m_startCodes.size();
|
||||
int i;
|
||||
|
||||
// endCount
|
||||
for (i = 0; i < segCount; i++) {
|
||||
Long n = (Long) m_endCodes.get(i);
|
||||
writeUInt16(n.intValue());
|
||||
} // for i
|
||||
|
||||
// reserverdPad
|
||||
writeUInt16(0);
|
||||
|
||||
// startCount
|
||||
for (i = 0; i < segCount; i++) {
|
||||
Long n = m_startCodes.get(i);
|
||||
writeUInt16(n.intValue());
|
||||
} // for i
|
||||
|
||||
// idDelta
|
||||
for (i = 0; i < segCount; i++) {
|
||||
Long n = m_idDeltas.get(i);
|
||||
writeInt16(n.intValue());
|
||||
} // for i
|
||||
|
||||
// idRangeOffset
|
||||
for (i = 0; i < segCount; i++) {
|
||||
Long n = m_idRangeOffsets.get(i);
|
||||
writeInt16(n.intValue());
|
||||
}
|
||||
|
||||
// glyphIdArray 2 bytes each
|
||||
for (i = 0; i < m_unicodes.size(); i++) {
|
||||
Long unicode = m_unicodes.get(i);
|
||||
writeUInt16((int) getGlyfIndex(unicode));
|
||||
} // for i
|
||||
|
||||
byte [] bytes = m_bytes.toByteArray();
|
||||
|
||||
reset();
|
||||
|
||||
writeUInt16(4);
|
||||
writeUInt16(bytes.length + 14);
|
||||
writeUInt16(0);
|
||||
writeUInt16(segCount * 2);
|
||||
|
||||
int searchRange = getSearchRange(segCount);
|
||||
writeUInt16(searchRange);
|
||||
writeUInt16(getEntrySelector(searchRange));
|
||||
writeUInt16(getRangeShift(segCount, searchRange));
|
||||
m_buffer.write(bytes);
|
||||
}
|
||||
|
||||
public void writeVersion12() throws IOException {
|
||||
ArrayList<Long> startCharCode = new ArrayList<>();
|
||||
ArrayList<Long> endCharCode = new ArrayList<>();
|
||||
ArrayList<Long> startGlyphCode = new ArrayList<>();
|
||||
|
||||
// TODO: map to real one
|
||||
startCharCode.add(k_basicLatinStart);
|
||||
endCharCode.add(k_basicLatinEnd);
|
||||
startGlyphCode.add(1L);
|
||||
|
||||
long length = 16 + 12 * startCharCode.size();
|
||||
|
||||
writeFixed32(12.0);
|
||||
writeUInt32(length);
|
||||
writeUInt32(0);
|
||||
writeUInt32(startCharCode.size());
|
||||
|
||||
int i;
|
||||
for (i = 0; i < startCharCode.size(); i++) {
|
||||
writeUInt32(startCharCode.get(i));
|
||||
writeUInt32(endCharCode.get(i));
|
||||
writeUInt32(startGlyphCode.get(i));
|
||||
} // for i
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for searchRange
|
||||
* @param a_value
|
||||
* @return
|
||||
*/
|
||||
private int getSearchRange(int a_value) {
|
||||
int retval
|
||||
= (int) Math.pow(2, Math.floor(Math.log(a_value) / Math.log(2)));
|
||||
return 2 * retval;
|
||||
}
|
||||
|
||||
private int getEntrySelector(int a_searchRange) {
|
||||
int retval
|
||||
= (int) (Math.log(a_searchRange / 2) / Math.log(2));
|
||||
return retval;
|
||||
}
|
||||
|
||||
private int getRangeShift(int a_value, int a_searchRange) {
|
||||
int retval
|
||||
= 2 * a_value - a_searchRange;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,286 +1,286 @@
|
||||
/*
|
||||
* $Id: FontFileWriter.java,v 1.15 2004/10/04 02:25:39 eed3si9n Exp $
|
||||
*
|
||||
* $Copyright: copyright (c) 2003, e.e d3si9n $
|
||||
* $License:
|
||||
* This source code is part of DoubleType.
|
||||
* DoubleType is a graphical typeface designer.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This Program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, e.e d3si9n gives permission to
|
||||
* link the code of this program with any Java Platform that is available
|
||||
* to public with free of charge, including but not limited to
|
||||
* Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE),
|
||||
* and distribute linked combinations including the two.
|
||||
* You must obey the GNU General Public License in all respects for all
|
||||
* of the code used other than Java Platform. If you modify this file,
|
||||
* you may extend this exception to your version of the file, but you are not
|
||||
* obligated to do so. If you do not wish to do so, delete this exception
|
||||
* statement from your version.
|
||||
* $
|
||||
*/
|
||||
|
||||
|
||||
package org.doubletype.ossa.truetype;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author e.e
|
||||
*/
|
||||
public class FontFileWriter extends FontFormatWriter {
|
||||
private CmapWriter m_cmap;
|
||||
private GlyfWriter m_glyf;
|
||||
private LocaWriter m_loca;
|
||||
private HeadWriter m_head;
|
||||
private HdmxWriter m_hdmx;
|
||||
private HheaWriter m_hhea;
|
||||
private HmtxWriter m_hmtx;
|
||||
private MaxpWriter m_maxp;
|
||||
private NameWriter m_name;
|
||||
private PostWriter m_post;
|
||||
private OS2Writer m_os2;
|
||||
|
||||
protected RandomAccessFile m_file;
|
||||
private ArrayList<FontFormatWriter> m_tables = new ArrayList<>();
|
||||
|
||||
public FontFileWriter(RandomAccessFile a_file) {
|
||||
super();
|
||||
|
||||
m_file = a_file;
|
||||
|
||||
m_loca = new LocaWriter();
|
||||
m_maxp = new MaxpWriter();
|
||||
m_head = new HeadWriter();
|
||||
m_hdmx = new HdmxWriter();
|
||||
m_os2 = new OS2Writer(m_head);
|
||||
m_cmap = new CmapWriter(m_os2);
|
||||
|
||||
m_glyf = new GlyfWriter(m_loca, m_maxp,
|
||||
m_head, m_hdmx);
|
||||
|
||||
m_hhea = new HheaWriter(m_glyf, m_head);
|
||||
m_hmtx = new HmtxWriter(m_glyf, m_hhea);
|
||||
m_name = new NameWriter();
|
||||
m_post = new PostWriter();
|
||||
|
||||
// http://www.microsoft.com/typography/otspec/recom.htm
|
||||
// head, hhea, maxp, OS/2, hmtx, LTSH, VDMX, hdmx, cmap,
|
||||
// fpgm, prep, cvt, loca, glyf, kern, name, post, gasp, PCLT, DSIG
|
||||
/*
|
||||
m_tables.add(m_head);
|
||||
m_tables.add(m_hhea);
|
||||
m_tables.add(m_maxp);
|
||||
m_tables.add(m_os2);
|
||||
m_tables.add(m_hmtx);
|
||||
m_tables.add(m_hdmx);
|
||||
m_tables.add(m_cmap);
|
||||
m_tables.add(m_loca);
|
||||
m_tables.add(m_glyf);
|
||||
m_tables.add(m_name);
|
||||
m_tables.add(m_post);
|
||||
*/
|
||||
|
||||
// Verdana has head, hhea, maxp, OS/2, gasp, name, cmap, loca
|
||||
// LTSH, VDMX, prep, fpgm, cvt, hmtx, hdmx, glyf, post, kern, edt0, DSIG
|
||||
m_tables.add(m_head);
|
||||
m_tables.add(m_hhea);
|
||||
m_tables.add(m_maxp);
|
||||
m_tables.add(m_os2);
|
||||
m_tables.add(m_name);
|
||||
m_tables.add(m_cmap);
|
||||
m_tables.add(m_loca);
|
||||
|
||||
m_tables.add(m_hmtx);
|
||||
m_tables.add(m_hdmx);
|
||||
m_tables.add(m_glyf);
|
||||
m_tables.add(m_post);
|
||||
}
|
||||
|
||||
/**
|
||||
* write TrueType file to the random access file
|
||||
*/
|
||||
public void write() throws IOException {
|
||||
m_cmap.write();
|
||||
// hmtx must be written before hhea
|
||||
m_hmtx.write();
|
||||
m_hhea.write();
|
||||
|
||||
m_glyf.write();
|
||||
m_loca.write();
|
||||
|
||||
m_head.setCheckSumAdjustment(0);
|
||||
m_head.write();
|
||||
m_maxp.write(); // must be written after m_glyf
|
||||
m_hdmx.write();
|
||||
m_name.write();
|
||||
m_post.write();
|
||||
m_os2.write();
|
||||
|
||||
writeTableDirectory();
|
||||
byte [] tableDir = toByteArray();
|
||||
for (FontFormatWriter table: m_tables) {
|
||||
m_buffer.write(table.toByteArray());
|
||||
} // for table
|
||||
|
||||
long checkSum = 0xb1b0afba - (0xffffffff & getCheckSum());
|
||||
m_head.setCheckSumAdjustment(checkSum);
|
||||
m_head.reset();
|
||||
m_head.write();
|
||||
|
||||
reset();
|
||||
|
||||
m_buffer.write(tableDir);
|
||||
for (FontFormatWriter table: m_tables) {
|
||||
m_buffer.write(table.toByteArray());
|
||||
} // for table
|
||||
|
||||
m_file.write(toByteArray());
|
||||
m_file.close();
|
||||
}
|
||||
|
||||
public void setAscent(int a_value) {
|
||||
m_os2.setTypoAscender(a_value);
|
||||
m_os2.setCapHeight(a_value);
|
||||
}
|
||||
|
||||
public void setDescent(int a_value) {
|
||||
m_os2.setTypoDescender(-a_value);
|
||||
}
|
||||
|
||||
public void setXHeight(int a_value) {
|
||||
m_os2.setXHeight(a_value);
|
||||
}
|
||||
|
||||
public void setLineGap(int a_value) {
|
||||
m_os2.setTypoLineGap(a_value);
|
||||
m_hhea.setLineGap(a_value);
|
||||
}
|
||||
|
||||
public void setFontFamilyName(String a_name) {
|
||||
m_name.m_familyName = a_name;
|
||||
}
|
||||
|
||||
public void setCopyrightYear(String a_year) {
|
||||
m_name.m_year = a_year;
|
||||
}
|
||||
|
||||
public void setManufacturer(String a_manufacturer) {
|
||||
m_name.m_manufacturer = a_manufacturer;
|
||||
}
|
||||
|
||||
public void setFontVersion(String a_version) {
|
||||
m_name.m_version = a_version;
|
||||
}
|
||||
|
||||
public void addUnicodeRange(TTUnicodeRange a_range) {
|
||||
m_cmap.addUnicodeRange(a_range);
|
||||
}
|
||||
|
||||
/**
|
||||
* http://www.microsoft.com/typography/otspec/os2.htm
|
||||
* @param a_codeRange position of the bit. For example, JIS will be 17.
|
||||
*/
|
||||
public void setCodeRangeFlag(int a_codeRange) {
|
||||
m_os2.setCodePageRangeFlag(a_codeRange);
|
||||
}
|
||||
|
||||
/**
|
||||
* adds glyph to the 'glyf' subtable.
|
||||
* @param a_glyph the glyph to be added.
|
||||
* @return 'glyf' index of the added glyph.
|
||||
*/
|
||||
public int addGlyph(TTGlyph a_glyph) {
|
||||
return m_glyf.add(a_glyph);
|
||||
}
|
||||
|
||||
public TTGlyph getGlyph(int a_index) {
|
||||
return m_glyf.getGlyph(a_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* adds character mapping to
|
||||
* @param a_unicode unicode of the character
|
||||
* @param a_glyfIndex 'glyf' index obtained from #addGlyph
|
||||
*/
|
||||
public void addCharacterMapping(long a_unicode, long a_glyfIndex) {
|
||||
m_cmap.addMapping(a_unicode, a_glyfIndex);
|
||||
}
|
||||
|
||||
public long getCharacterMapping(long a_unicode) {
|
||||
return m_cmap.getGlyfIndex(new Long(a_unicode));
|
||||
}
|
||||
|
||||
/**
|
||||
* writes table directory.
|
||||
* @throws IOException
|
||||
*/
|
||||
private void writeTableDirectory() throws IOException {
|
||||
int headerLength = m_tables.size() * 16 + 16;
|
||||
int tableOffset = headerLength;
|
||||
for (FontFormatWriter table: m_tables) {
|
||||
table.setOffset(tableOffset);
|
||||
tableOffset += table.size();
|
||||
} // for table
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<FontFormatWriter> tables = (ArrayList<FontFormatWriter>) m_tables.clone();
|
||||
Collections.sort(tables, new Comparator<FontFormatWriter>() {
|
||||
public int compare(FontFormatWriter a_lhs, FontFormatWriter a_rhs) {
|
||||
return a_lhs.getTag().compareTo(a_rhs.getTag());
|
||||
}
|
||||
|
||||
public boolean equals(Object a_value) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
writeFixed32(1.0);
|
||||
|
||||
int numOfTables = tables.size();
|
||||
writeUInt16(numOfTables);
|
||||
int searchRange = getSearchRange(numOfTables);
|
||||
writeUInt16(searchRange);
|
||||
int entrySelector = getEntrySelector(numOfTables);
|
||||
writeUInt16(entrySelector);
|
||||
writeUInt16(numOfTables * 16 - searchRange);
|
||||
|
||||
for (FontFormatWriter table: tables) {
|
||||
writeTag(table.getTag());
|
||||
writeUInt32(table.getCheckSum());
|
||||
writeUInt32(table.getOffset());
|
||||
writeUInt32(table.size());
|
||||
} // for
|
||||
|
||||
// padding is always 4 zeros
|
||||
for (int i = 0; i < 4; i++) {
|
||||
writeUInt8(0);
|
||||
} // for i
|
||||
}
|
||||
|
||||
private int getSearchRange(int a_value) {
|
||||
int retval
|
||||
= (int) (Math.pow(2, Math.floor(Math.log(a_value) / Math.log(2))));
|
||||
return 16 * retval;
|
||||
}
|
||||
|
||||
private int getEntrySelector(int a_value) {
|
||||
int retval
|
||||
= (int) Math.floor(Math.log(a_value) / Math.log(2));
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* $Id: FontFileWriter.java,v 1.15 2004/10/04 02:25:39 eed3si9n Exp $
|
||||
*
|
||||
* $Copyright: copyright (c) 2003, e.e d3si9n $
|
||||
* $License:
|
||||
* This source code is part of DoubleType.
|
||||
* DoubleType is a graphical typeface designer.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This Program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, e.e d3si9n gives permission to
|
||||
* link the code of this program with any Java Platform that is available
|
||||
* to public with free of charge, including but not limited to
|
||||
* Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE),
|
||||
* and distribute linked combinations including the two.
|
||||
* You must obey the GNU General Public License in all respects for all
|
||||
* of the code used other than Java Platform. If you modify this file,
|
||||
* you may extend this exception to your version of the file, but you are not
|
||||
* obligated to do so. If you do not wish to do so, delete this exception
|
||||
* statement from your version.
|
||||
* $
|
||||
*/
|
||||
|
||||
|
||||
package org.doubletype.ossa.truetype;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author e.e
|
||||
*/
|
||||
public class FontFileWriter extends FontFormatWriter {
|
||||
private CmapWriter m_cmap;
|
||||
private GlyfWriter m_glyf;
|
||||
private LocaWriter m_loca;
|
||||
private HeadWriter m_head;
|
||||
private HdmxWriter m_hdmx;
|
||||
private HheaWriter m_hhea;
|
||||
private HmtxWriter m_hmtx;
|
||||
private MaxpWriter m_maxp;
|
||||
private NameWriter m_name;
|
||||
private PostWriter m_post;
|
||||
private OS2Writer m_os2;
|
||||
|
||||
protected RandomAccessFile m_file;
|
||||
private ArrayList<FontFormatWriter> m_tables = new ArrayList<>();
|
||||
|
||||
public FontFileWriter(RandomAccessFile a_file) {
|
||||
super();
|
||||
|
||||
m_file = a_file;
|
||||
|
||||
m_loca = new LocaWriter();
|
||||
m_maxp = new MaxpWriter();
|
||||
m_head = new HeadWriter();
|
||||
m_hdmx = new HdmxWriter();
|
||||
m_os2 = new OS2Writer(m_head);
|
||||
m_cmap = new CmapWriter(m_os2);
|
||||
|
||||
m_glyf = new GlyfWriter(m_loca, m_maxp,
|
||||
m_head, m_hdmx);
|
||||
|
||||
m_hhea = new HheaWriter(m_glyf, m_head);
|
||||
m_hmtx = new HmtxWriter(m_glyf, m_hhea);
|
||||
m_name = new NameWriter();
|
||||
m_post = new PostWriter();
|
||||
|
||||
// http://www.microsoft.com/typography/otspec/recom.htm
|
||||
// head, hhea, maxp, OS/2, hmtx, LTSH, VDMX, hdmx, cmap,
|
||||
// fpgm, prep, cvt, loca, glyf, kern, name, post, gasp, PCLT, DSIG
|
||||
/*
|
||||
m_tables.add(m_head);
|
||||
m_tables.add(m_hhea);
|
||||
m_tables.add(m_maxp);
|
||||
m_tables.add(m_os2);
|
||||
m_tables.add(m_hmtx);
|
||||
m_tables.add(m_hdmx);
|
||||
m_tables.add(m_cmap);
|
||||
m_tables.add(m_loca);
|
||||
m_tables.add(m_glyf);
|
||||
m_tables.add(m_name);
|
||||
m_tables.add(m_post);
|
||||
*/
|
||||
|
||||
// Verdana has head, hhea, maxp, OS/2, gasp, name, cmap, loca
|
||||
// LTSH, VDMX, prep, fpgm, cvt, hmtx, hdmx, glyf, post, kern, edt0, DSIG
|
||||
m_tables.add(m_head);
|
||||
m_tables.add(m_hhea);
|
||||
m_tables.add(m_maxp);
|
||||
m_tables.add(m_os2);
|
||||
m_tables.add(m_name);
|
||||
m_tables.add(m_cmap);
|
||||
m_tables.add(m_loca);
|
||||
|
||||
m_tables.add(m_hmtx);
|
||||
m_tables.add(m_hdmx);
|
||||
m_tables.add(m_glyf);
|
||||
m_tables.add(m_post);
|
||||
}
|
||||
|
||||
/**
|
||||
* write TrueType file to the random access file
|
||||
*/
|
||||
public void write() throws IOException {
|
||||
m_cmap.write();
|
||||
// hmtx must be written before hhea
|
||||
m_hmtx.write();
|
||||
m_hhea.write();
|
||||
|
||||
m_glyf.write();
|
||||
m_loca.write();
|
||||
|
||||
m_head.setCheckSumAdjustment(0);
|
||||
m_head.write();
|
||||
m_maxp.write(); // must be written after m_glyf
|
||||
m_hdmx.write();
|
||||
m_name.write();
|
||||
m_post.write();
|
||||
m_os2.write();
|
||||
|
||||
writeTableDirectory();
|
||||
byte [] tableDir = toByteArray();
|
||||
for (FontFormatWriter table: m_tables) {
|
||||
m_buffer.write(table.toByteArray());
|
||||
} // for table
|
||||
|
||||
long checkSum = 0xb1b0afba - (0xffffffff & getCheckSum());
|
||||
m_head.setCheckSumAdjustment(checkSum);
|
||||
m_head.reset();
|
||||
m_head.write();
|
||||
|
||||
reset();
|
||||
|
||||
m_buffer.write(tableDir);
|
||||
for (FontFormatWriter table: m_tables) {
|
||||
m_buffer.write(table.toByteArray());
|
||||
} // for table
|
||||
|
||||
m_file.write(toByteArray());
|
||||
m_file.close();
|
||||
}
|
||||
|
||||
public void setAscent(int a_value) {
|
||||
m_os2.setTypoAscender(a_value);
|
||||
m_os2.setCapHeight(a_value);
|
||||
}
|
||||
|
||||
public void setDescent(int a_value) {
|
||||
m_os2.setTypoDescender(-a_value);
|
||||
}
|
||||
|
||||
public void setXHeight(int a_value) {
|
||||
m_os2.setXHeight(a_value);
|
||||
}
|
||||
|
||||
public void setLineGap(int a_value) {
|
||||
m_os2.setTypoLineGap(a_value);
|
||||
m_hhea.setLineGap(a_value);
|
||||
}
|
||||
|
||||
public void setFontFamilyName(String a_name) {
|
||||
m_name.m_familyName = a_name;
|
||||
}
|
||||
|
||||
public void setCopyrightYear(String a_year) {
|
||||
m_name.m_year = a_year;
|
||||
}
|
||||
|
||||
public void setManufacturer(String a_manufacturer) {
|
||||
m_name.m_manufacturer = a_manufacturer;
|
||||
}
|
||||
|
||||
public void setFontVersion(String a_version) {
|
||||
m_name.m_version = a_version;
|
||||
}
|
||||
|
||||
public void addUnicodeRange(TTUnicodeRange a_range) {
|
||||
m_cmap.addUnicodeRange(a_range);
|
||||
}
|
||||
|
||||
/**
|
||||
* http://www.microsoft.com/typography/otspec/os2.htm
|
||||
* @param a_codeRange position of the bit. For example, JIS will be 17.
|
||||
*/
|
||||
public void setCodeRangeFlag(int a_codeRange) {
|
||||
m_os2.setCodePageRangeFlag(a_codeRange);
|
||||
}
|
||||
|
||||
/**
|
||||
* adds glyph to the 'glyf' subtable.
|
||||
* @param a_glyph the glyph to be added.
|
||||
* @return 'glyf' index of the added glyph.
|
||||
*/
|
||||
public int addGlyph(TTGlyph a_glyph) {
|
||||
return m_glyf.add(a_glyph);
|
||||
}
|
||||
|
||||
public TTGlyph getGlyph(int a_index) {
|
||||
return m_glyf.getGlyph(a_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* adds character mapping to
|
||||
* @param a_unicode unicode of the character
|
||||
* @param a_glyfIndex 'glyf' index obtained from #addGlyph
|
||||
*/
|
||||
public void addCharacterMapping(long a_unicode, long a_glyfIndex) {
|
||||
m_cmap.addMapping(a_unicode, a_glyfIndex);
|
||||
}
|
||||
|
||||
public long getCharacterMapping(long a_unicode) {
|
||||
return m_cmap.getGlyfIndex(new Long(a_unicode));
|
||||
}
|
||||
|
||||
/**
|
||||
* writes table directory.
|
||||
* @throws IOException
|
||||
*/
|
||||
private void writeTableDirectory() throws IOException {
|
||||
int headerLength = m_tables.size() * 16 + 16;
|
||||
int tableOffset = headerLength;
|
||||
for (FontFormatWriter table: m_tables) {
|
||||
table.setOffset(tableOffset);
|
||||
tableOffset += table.size();
|
||||
} // for table
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<FontFormatWriter> tables = (ArrayList<FontFormatWriter>) m_tables.clone();
|
||||
Collections.sort(tables, new Comparator<FontFormatWriter>() {
|
||||
public int compare(FontFormatWriter a_lhs, FontFormatWriter a_rhs) {
|
||||
return a_lhs.getTag().compareTo(a_rhs.getTag());
|
||||
}
|
||||
|
||||
public boolean equals(Object a_value) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
writeFixed32(1.0);
|
||||
|
||||
int numOfTables = tables.size();
|
||||
writeUInt16(numOfTables);
|
||||
int searchRange = getSearchRange(numOfTables);
|
||||
writeUInt16(searchRange);
|
||||
int entrySelector = getEntrySelector(numOfTables);
|
||||
writeUInt16(entrySelector);
|
||||
writeUInt16(numOfTables * 16 - searchRange);
|
||||
|
||||
for (FontFormatWriter table: tables) {
|
||||
writeTag(table.getTag());
|
||||
writeUInt32(table.getCheckSum());
|
||||
writeUInt32(table.getOffset());
|
||||
writeUInt32(table.size());
|
||||
} // for
|
||||
|
||||
// padding is always 4 zeros
|
||||
for (int i = 0; i < 4; i++) {
|
||||
writeUInt8(0);
|
||||
} // for i
|
||||
}
|
||||
|
||||
private int getSearchRange(int a_value) {
|
||||
int retval
|
||||
= (int) (Math.pow(2, Math.floor(Math.log(a_value) / Math.log(2))));
|
||||
return 16 * retval;
|
||||
}
|
||||
|
||||
private int getEntrySelector(int a_value) {
|
||||
int retval
|
||||
= (int) Math.floor(Math.log(a_value) / Math.log(2));
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,380 +1,380 @@
|
||||
/*
|
||||
* $Id: TTUnicodeRange.java,v 1.1 2004/01/25 11:00:10 eed3si9n Exp $
|
||||
*
|
||||
* $Copyright: copyright (c) 2003-2004, e.e d3si9n $
|
||||
* $License:
|
||||
* This source code is part of DoubleType.
|
||||
* DoubleType is a graphical typeface designer.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This Program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, e.e d3si9n gives permission to
|
||||
* link the code of this program with any Java Platform that is available
|
||||
* to public with free of charge, including but not limited to
|
||||
* Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE),
|
||||
* and distribute linked combinations including the two.
|
||||
* You must obey the GNU General Public License in all respects for all
|
||||
* of the code used other than Java Platform. If you modify this file,
|
||||
* you may extend this exception to your version of the file, but you are not
|
||||
* obligated to do so. If you do not wish to do so, delete this exception
|
||||
* statement from your version.
|
||||
* $
|
||||
*/
|
||||
|
||||
package org.doubletype.ossa.truetype;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import java.lang.Character.UnicodeBlock;
|
||||
|
||||
/**
|
||||
* @author e.e
|
||||
*/
|
||||
public class TTUnicodeRange implements Comparable {
|
||||
public static final long k_notDef = 0x0001;
|
||||
public static final long k_null = 0x0000;
|
||||
public static final long k_cr = 0x000D;
|
||||
public static final long k_space = 0x0020;
|
||||
|
||||
static private boolean s_isInitialized = false;
|
||||
static private ArrayList<TTUnicodeRange> s_list = new ArrayList<>();
|
||||
static private TTUnicodeRange s_selected = null;
|
||||
|
||||
static public TTUnicodeRange of(long a_unicode) {
|
||||
initList();
|
||||
|
||||
TTUnicodeRange retval = null;
|
||||
UnicodeBlock block = UnicodeBlock.of((int)a_unicode);
|
||||
if (block == null)
|
||||
return retval;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < s_list.size(); i++) {
|
||||
TTUnicodeRange range = s_list.get(i);
|
||||
if (range.m_block.equals(block)) {
|
||||
return range;
|
||||
} // if
|
||||
} // for i
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static public TTUnicodeRange getLastFound() {
|
||||
return s_selected;
|
||||
}
|
||||
|
||||
static private void initList() {
|
||||
if (s_isInitialized)
|
||||
return;
|
||||
|
||||
s_isInitialized = true;
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BASIC_LATIN, 0x0020, 0x007F, 0, 63));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LATIN_1_SUPPLEMENT, 0x0080, 0x00FF, 1, 0));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LATIN_EXTENDED_A, 0x0100, 0x017f, 2));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LATIN_EXTENDED_B, 0x0180, 0x024f, 3));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.IPA_EXTENSIONS, 0x0250, 0x02af, 4));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.SPACING_MODIFIER_LETTERS, 0x02B0, 0x02FF, 5));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.COMBINING_DIACRITICAL_MARKS, 0x0300, 0x036F, 6));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GREEK, 0x0370, 0x03FF, 7, 3));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CYRILLIC, 0x0400, 0x04FF, 9, 2));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ARMENIAN, 0x0530, 0x058F, 10));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HEBREW, 0x0590, 0x05FF, 11, 5));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ARABIC, 0x0600, 0x06FF, 13, 6));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.SYRIAC, 0x0700, 0x074F, 71));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.THAANA, 0x0780, 0x07BF, 72));
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.DEVANAGARI, 0x0900, 0x097F, 15));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BENGALI, 0x0980, 0x09FF, 16));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GURMUKHI, 0x0A00, 0x0A7F, 17));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GUJARATI, 0x0A80, 0x0AFF, 18));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ORIYA, 0x0B00, 0x0B7F, 19));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.TAMIL, 0x0B80, 0x0BFF, 20));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.TELUGU, 0x0C00, 0x0C7F, 21));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.KANNADA, 0x0C80, 0x0CFF, 22));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.MALAYALAM, 0x0D00, 0x0D7F, 23));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.SINHALA, 0x0D80, 0x0DFF, 73));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.THAI, 0x0E00, 0x0E7F, 24, 16));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LAO, 0x0E80, 0x0EFF, 25));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.TIBETAN, 0x0F00, 0x0FFF, 70));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.MYANMAR, 0x1000, 0x109F, 74));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GEORGIAN, 0x10A0, 0x10FF, 26));
|
||||
// TODO: wansung or johab?
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HANGUL_JAMO, 0x1100, 0x11FF, 28, 19));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ETHIOPIC, 0x1200, 0x137F, 75));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CHEROKEE, 0x13A0, 0x13FF, 76));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS, 0x1400, 0x167F, 77));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.OGHAM, 0x1680, 0x169F, 78));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.RUNIC, 0x16A0, 0x16FF, 79));
|
||||
|
||||
// TODO: tagalog, hanunoo, buhid, tagbanwa
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.KHMER, 0x1780, 0x17FF, 80));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.MONGOLIAN, 0x1800, 0x18AF, 81));
|
||||
|
||||
// linbu, tai le, khmer symbol, phonetic extensions,
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LATIN_EXTENDED_ADDITIONAL, 0x1E00, 0x1EFF, 29));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GREEK_EXTENDED, 0x1F00, 0x1FFF, 30));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GENERAL_PUNCTUATION, 0x2000, 0x206F, 31));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.SUPERSCRIPTS_AND_SUBSCRIPTS, 0x2070, 0x209F, 32));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CURRENCY_SYMBOLS, 0x20A0, 0x20CF, 33));
|
||||
|
||||
// combining diacritical marks
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.COMBINING_MARKS_FOR_SYMBOLS, 0x20D0, 0x20FF, 34));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LETTERLIKE_SYMBOLS, 0x2100, 0x214F, 35));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.NUMBER_FORMS, 0x2150, 0x218F, 36));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ARROWS, 0x2190, 0x21FF, 37));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.MATHEMATICAL_OPERATORS, 0x2200, 0x22FF, 38));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.MISCELLANEOUS_TECHNICAL, 0x2300, 0x23FF, 39));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CONTROL_PICTURES, 0x2400, 0x243F, 40));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.OPTICAL_CHARACTER_RECOGNITION, 0x2440, 0x245F, 41));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ENCLOSED_ALPHANUMERICS, 0x2460, 0x24FF, 42));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BOX_DRAWING, 0x2500, 0x257F, 43));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BLOCK_ELEMENTS, 0x2580, 0x259F, 44));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GEOMETRIC_SHAPES, 0x25A0, 0x25FF, 45));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.MISCELLANEOUS_SYMBOLS, 0x2600, 0x26FF, 46));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.DINGBATS, 0x2700, 0x27BF, 47));
|
||||
|
||||
// TODO: mics. math symbols A, supplemental arrows A
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BRAILLE_PATTERNS, 0x2800, 0x28FF, 82));
|
||||
|
||||
// TODO: supplemental arrows B, mics. math symbols B,
|
||||
// supplemental math op., mics. symbols and arrows
|
||||
|
||||
|
||||
// CJKV supplements
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_RADICALS_SUPPLEMENT, 0x2E80, 0x2EFF, 59));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.KANGXI_RADICALS, 0x2F00, 0x2FDF, 59));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.IDEOGRAPHIC_DESCRIPTION_CHARACTERS, 0x2FF0, 0x2FFF, 59));
|
||||
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION, 0x3000, 0x303f, 48));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HIRAGANA, 0x3040, 0x309f, 49, 17));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.KATAKANA, 0x30a0, 0x30ff, 50, 17));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BOPOMOFO, 0x3100, 0x312f, 51));
|
||||
// TODO: wansung or johab?
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HANGUL_COMPATIBILITY_JAMO, 0x3130, 0x0318F, 52, 19));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.KANBUN, 0x3190, 0x319F, 59));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BOPOMOFO_EXTENDED, 0x31A0, 0x31BF, 51));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.KATAKANA_PHONETIC_EXTENSIONS, 0x31F0, 0x31FF, 50, 17));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ENCLOSED_CJK_LETTERS_AND_MONTHS, 0x3200, 0x32FF, 54));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_COMPATIBILITY, 0x3300, 0x33ff, 55));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A, 0x03400, 0x4dbf, 59));
|
||||
// TODO: yijing hex symbols
|
||||
|
||||
// the kanji characters
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS, 0x4e00, 0x9fff, 59, 17));
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.YI_SYLLABLES, 0xA000, 0xA48F, 83));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.YI_RADICALS, 0xA490, 0xA4CF, 83));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HANGUL_SYLLABLES, 0xAC00, 0xD7AF, 56));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HIGH_SURROGATES, 0xD800, 0xDB7F, 0));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HIGH_PRIVATE_USE_SURROGATES, 0xDB80, 0xDBFF, 0));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LOW_SURROGATES, 0xDC00, 0xDFFF, 0));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.PRIVATE_USE_AREA, 0xE000, 0xF8FF, 60));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS, 0xf900, 0xfaff, 61));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ALPHABETIC_PRESENTATION_FORMS, 0xFB00, 0xFB4F, 62));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ARABIC_PRESENTATION_FORMS_A, 0xFB50, 0xFDFF, 62));
|
||||
|
||||
// TODO: variation selectors
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.COMBINING_HALF_MARKS, 0xFE20, 0xFE2F, 64));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_COMPATIBILITY_FORMS, 0xFE30, 0xFE4F, 65));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.SMALL_FORM_VARIANTS, 0xFE50, 0xFE6F, 66));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ARABIC_PRESENTATION_FORMS_B, 0xFE70, 0xFEFF, 67));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS, 0xFF00, 0xFFEF, 68, 17));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.SPECIALS, 0xFFF0, 0xFFFF, 69));
|
||||
}
|
||||
|
||||
static public boolean find(String a_unicodeRange) {
|
||||
initList();
|
||||
|
||||
s_selected = null;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < s_list.size(); i++) {
|
||||
TTUnicodeRange range = (TTUnicodeRange) s_list.get(i);
|
||||
if (range.m_block.toString().equals(a_unicodeRange)) {
|
||||
s_selected = range;
|
||||
|
||||
return true;
|
||||
} // if
|
||||
} // for i
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private UnicodeBlock m_block = null;
|
||||
private long m_start = 0;
|
||||
private long m_end = 0;
|
||||
|
||||
/** http://www.microsoft.com/typography/otspec/os2.htm
|
||||
*/
|
||||
private int m_osTwoFlag = 0;
|
||||
|
||||
/** http://www.microsoft.com/typography/otspec/os2.htm
|
||||
*/
|
||||
private int m_codePageFlag = 0;
|
||||
|
||||
public TTUnicodeRange(UnicodeBlock a_block,
|
||||
long a_start,
|
||||
long a_end,
|
||||
int a_osTwoFlag)
|
||||
{
|
||||
m_block = a_block;
|
||||
m_start = a_start;
|
||||
m_end = a_end;
|
||||
m_osTwoFlag = a_osTwoFlag;
|
||||
}
|
||||
|
||||
public TTUnicodeRange(UnicodeBlock a_block,
|
||||
long a_start,
|
||||
long a_end,
|
||||
int a_osTwoFlag,
|
||||
int a_codePageFlag)
|
||||
{
|
||||
m_block = a_block;
|
||||
m_start = a_start;
|
||||
m_end = a_end;
|
||||
m_osTwoFlag = a_osTwoFlag;
|
||||
m_codePageFlag = a_codePageFlag;
|
||||
}
|
||||
|
||||
public boolean equals(Object a_object) {
|
||||
TTUnicodeRange object = (TTUnicodeRange) a_object;
|
||||
return (m_start == object.m_start);
|
||||
}
|
||||
|
||||
public int compareTo(Object a_object) {
|
||||
TTUnicodeRange object = (TTUnicodeRange) a_object;
|
||||
if (this.m_start < object.m_start) {
|
||||
return -1;
|
||||
} else if (this.m_start == object.m_start) {
|
||||
return 0;
|
||||
} else
|
||||
return 1;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return m_block.toString();
|
||||
}
|
||||
|
||||
public long getStartCode() {
|
||||
return m_start;
|
||||
}
|
||||
|
||||
public long getEndCode() {
|
||||
return m_end;
|
||||
}
|
||||
|
||||
public int getOsTwoFlag() {
|
||||
return m_osTwoFlag;
|
||||
}
|
||||
|
||||
public int getCodeRangeFlag() {
|
||||
return m_codePageFlag;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* $Id: TTUnicodeRange.java,v 1.1 2004/01/25 11:00:10 eed3si9n Exp $
|
||||
*
|
||||
* $Copyright: copyright (c) 2003-2004, e.e d3si9n $
|
||||
* $License:
|
||||
* This source code is part of DoubleType.
|
||||
* DoubleType is a graphical typeface designer.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This Program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, e.e d3si9n gives permission to
|
||||
* link the code of this program with any Java Platform that is available
|
||||
* to public with free of charge, including but not limited to
|
||||
* Sun Microsystem's JAVA(TM) 2 RUNTIME ENVIRONMENT (J2RE),
|
||||
* and distribute linked combinations including the two.
|
||||
* You must obey the GNU General Public License in all respects for all
|
||||
* of the code used other than Java Platform. If you modify this file,
|
||||
* you may extend this exception to your version of the file, but you are not
|
||||
* obligated to do so. If you do not wish to do so, delete this exception
|
||||
* statement from your version.
|
||||
* $
|
||||
*/
|
||||
|
||||
package org.doubletype.ossa.truetype;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import java.lang.Character.UnicodeBlock;
|
||||
|
||||
/**
|
||||
* @author e.e
|
||||
*/
|
||||
public class TTUnicodeRange implements Comparable<TTUnicodeRange> {
|
||||
public static final long k_notDef = 0x0001;
|
||||
public static final long k_null = 0x0000;
|
||||
public static final long k_cr = 0x000D;
|
||||
public static final long k_space = 0x0020;
|
||||
|
||||
static private boolean s_isInitialized = false;
|
||||
static private ArrayList<TTUnicodeRange> s_list = new ArrayList<>();
|
||||
static private TTUnicodeRange s_selected = null;
|
||||
|
||||
static public TTUnicodeRange of(long a_unicode) {
|
||||
initList();
|
||||
|
||||
TTUnicodeRange retval = null;
|
||||
UnicodeBlock block = UnicodeBlock.of((int)a_unicode);
|
||||
if (block == null)
|
||||
return retval;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < s_list.size(); i++) {
|
||||
TTUnicodeRange range = s_list.get(i);
|
||||
if (range.m_block.equals(block)) {
|
||||
return range;
|
||||
} // if
|
||||
} // for i
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static public TTUnicodeRange getLastFound() {
|
||||
return s_selected;
|
||||
}
|
||||
|
||||
static private void initList() {
|
||||
if (s_isInitialized)
|
||||
return;
|
||||
|
||||
s_isInitialized = true;
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BASIC_LATIN, 0x0020, 0x007F, 0, 63));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LATIN_1_SUPPLEMENT, 0x0080, 0x00FF, 1, 0));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LATIN_EXTENDED_A, 0x0100, 0x017f, 2));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LATIN_EXTENDED_B, 0x0180, 0x024f, 3));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.IPA_EXTENSIONS, 0x0250, 0x02af, 4));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.SPACING_MODIFIER_LETTERS, 0x02B0, 0x02FF, 5));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.COMBINING_DIACRITICAL_MARKS, 0x0300, 0x036F, 6));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GREEK, 0x0370, 0x03FF, 7, 3));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CYRILLIC, 0x0400, 0x04FF, 9, 2));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ARMENIAN, 0x0530, 0x058F, 10));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HEBREW, 0x0590, 0x05FF, 11, 5));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ARABIC, 0x0600, 0x06FF, 13, 6));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.SYRIAC, 0x0700, 0x074F, 71));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.THAANA, 0x0780, 0x07BF, 72));
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.DEVANAGARI, 0x0900, 0x097F, 15));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BENGALI, 0x0980, 0x09FF, 16));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GURMUKHI, 0x0A00, 0x0A7F, 17));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GUJARATI, 0x0A80, 0x0AFF, 18));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ORIYA, 0x0B00, 0x0B7F, 19));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.TAMIL, 0x0B80, 0x0BFF, 20));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.TELUGU, 0x0C00, 0x0C7F, 21));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.KANNADA, 0x0C80, 0x0CFF, 22));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.MALAYALAM, 0x0D00, 0x0D7F, 23));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.SINHALA, 0x0D80, 0x0DFF, 73));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.THAI, 0x0E00, 0x0E7F, 24, 16));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LAO, 0x0E80, 0x0EFF, 25));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.TIBETAN, 0x0F00, 0x0FFF, 70));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.MYANMAR, 0x1000, 0x109F, 74));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GEORGIAN, 0x10A0, 0x10FF, 26));
|
||||
// TODO: wansung or johab?
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HANGUL_JAMO, 0x1100, 0x11FF, 28, 19));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ETHIOPIC, 0x1200, 0x137F, 75));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CHEROKEE, 0x13A0, 0x13FF, 76));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS, 0x1400, 0x167F, 77));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.OGHAM, 0x1680, 0x169F, 78));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.RUNIC, 0x16A0, 0x16FF, 79));
|
||||
|
||||
// TODO: tagalog, hanunoo, buhid, tagbanwa
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.KHMER, 0x1780, 0x17FF, 80));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.MONGOLIAN, 0x1800, 0x18AF, 81));
|
||||
|
||||
// linbu, tai le, khmer symbol, phonetic extensions,
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LATIN_EXTENDED_ADDITIONAL, 0x1E00, 0x1EFF, 29));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GREEK_EXTENDED, 0x1F00, 0x1FFF, 30));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GENERAL_PUNCTUATION, 0x2000, 0x206F, 31));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.SUPERSCRIPTS_AND_SUBSCRIPTS, 0x2070, 0x209F, 32));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CURRENCY_SYMBOLS, 0x20A0, 0x20CF, 33));
|
||||
|
||||
// combining diacritical marks
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.COMBINING_MARKS_FOR_SYMBOLS, 0x20D0, 0x20FF, 34));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LETTERLIKE_SYMBOLS, 0x2100, 0x214F, 35));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.NUMBER_FORMS, 0x2150, 0x218F, 36));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ARROWS, 0x2190, 0x21FF, 37));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.MATHEMATICAL_OPERATORS, 0x2200, 0x22FF, 38));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.MISCELLANEOUS_TECHNICAL, 0x2300, 0x23FF, 39));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CONTROL_PICTURES, 0x2400, 0x243F, 40));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.OPTICAL_CHARACTER_RECOGNITION, 0x2440, 0x245F, 41));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ENCLOSED_ALPHANUMERICS, 0x2460, 0x24FF, 42));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BOX_DRAWING, 0x2500, 0x257F, 43));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BLOCK_ELEMENTS, 0x2580, 0x259F, 44));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.GEOMETRIC_SHAPES, 0x25A0, 0x25FF, 45));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.MISCELLANEOUS_SYMBOLS, 0x2600, 0x26FF, 46));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.DINGBATS, 0x2700, 0x27BF, 47));
|
||||
|
||||
// TODO: mics. math symbols A, supplemental arrows A
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BRAILLE_PATTERNS, 0x2800, 0x28FF, 82));
|
||||
|
||||
// TODO: supplemental arrows B, mics. math symbols B,
|
||||
// supplemental math op., mics. symbols and arrows
|
||||
|
||||
|
||||
// CJKV supplements
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_RADICALS_SUPPLEMENT, 0x2E80, 0x2EFF, 59));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.KANGXI_RADICALS, 0x2F00, 0x2FDF, 59));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.IDEOGRAPHIC_DESCRIPTION_CHARACTERS, 0x2FF0, 0x2FFF, 59));
|
||||
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION, 0x3000, 0x303f, 48));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HIRAGANA, 0x3040, 0x309f, 49, 17));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.KATAKANA, 0x30a0, 0x30ff, 50, 17));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BOPOMOFO, 0x3100, 0x312f, 51));
|
||||
// TODO: wansung or johab?
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HANGUL_COMPATIBILITY_JAMO, 0x3130, 0x0318F, 52, 19));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.KANBUN, 0x3190, 0x319F, 59));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.BOPOMOFO_EXTENDED, 0x31A0, 0x31BF, 51));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.KATAKANA_PHONETIC_EXTENSIONS, 0x31F0, 0x31FF, 50, 17));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ENCLOSED_CJK_LETTERS_AND_MONTHS, 0x3200, 0x32FF, 54));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_COMPATIBILITY, 0x3300, 0x33ff, 55));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A, 0x03400, 0x4dbf, 59));
|
||||
// TODO: yijing hex symbols
|
||||
|
||||
// the kanji characters
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS, 0x4e00, 0x9fff, 59, 17));
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.YI_SYLLABLES, 0xA000, 0xA48F, 83));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.YI_RADICALS, 0xA490, 0xA4CF, 83));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HANGUL_SYLLABLES, 0xAC00, 0xD7AF, 56));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HIGH_SURROGATES, 0xD800, 0xDB7F, 0));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HIGH_PRIVATE_USE_SURROGATES, 0xDB80, 0xDBFF, 0));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.LOW_SURROGATES, 0xDC00, 0xDFFF, 0));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.PRIVATE_USE_AREA, 0xE000, 0xF8FF, 60));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS, 0xf900, 0xfaff, 61));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ALPHABETIC_PRESENTATION_FORMS, 0xFB00, 0xFB4F, 62));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ARABIC_PRESENTATION_FORMS_A, 0xFB50, 0xFDFF, 62));
|
||||
|
||||
// TODO: variation selectors
|
||||
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.COMBINING_HALF_MARKS, 0xFE20, 0xFE2F, 64));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.CJK_COMPATIBILITY_FORMS, 0xFE30, 0xFE4F, 65));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.SMALL_FORM_VARIANTS, 0xFE50, 0xFE6F, 66));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.ARABIC_PRESENTATION_FORMS_B, 0xFE70, 0xFEFF, 67));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS, 0xFF00, 0xFFEF, 68, 17));
|
||||
s_list.add(new TTUnicodeRange(
|
||||
UnicodeBlock.SPECIALS, 0xFFF0, 0xFFFF, 69));
|
||||
}
|
||||
|
||||
static public boolean find(String a_unicodeRange) {
|
||||
initList();
|
||||
|
||||
s_selected = null;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < s_list.size(); i++) {
|
||||
TTUnicodeRange range = (TTUnicodeRange) s_list.get(i);
|
||||
if (range.m_block.toString().equals(a_unicodeRange)) {
|
||||
s_selected = range;
|
||||
|
||||
return true;
|
||||
} // if
|
||||
} // for i
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private UnicodeBlock m_block = null;
|
||||
private long m_start = 0;
|
||||
private long m_end = 0;
|
||||
|
||||
/** http://www.microsoft.com/typography/otspec/os2.htm
|
||||
*/
|
||||
private int m_osTwoFlag = 0;
|
||||
|
||||
/** http://www.microsoft.com/typography/otspec/os2.htm
|
||||
*/
|
||||
private int m_codePageFlag = 0;
|
||||
|
||||
public TTUnicodeRange(UnicodeBlock a_block,
|
||||
long a_start,
|
||||
long a_end,
|
||||
int a_osTwoFlag)
|
||||
{
|
||||
m_block = a_block;
|
||||
m_start = a_start;
|
||||
m_end = a_end;
|
||||
m_osTwoFlag = a_osTwoFlag;
|
||||
}
|
||||
|
||||
public TTUnicodeRange(UnicodeBlock a_block,
|
||||
long a_start,
|
||||
long a_end,
|
||||
int a_osTwoFlag,
|
||||
int a_codePageFlag)
|
||||
{
|
||||
m_block = a_block;
|
||||
m_start = a_start;
|
||||
m_end = a_end;
|
||||
m_osTwoFlag = a_osTwoFlag;
|
||||
m_codePageFlag = a_codePageFlag;
|
||||
}
|
||||
|
||||
public boolean equals(Object a_object) {
|
||||
TTUnicodeRange object = (TTUnicodeRange) a_object;
|
||||
return (m_start == object.m_start);
|
||||
}
|
||||
|
||||
public int compareTo(TTUnicodeRange a_object) {
|
||||
TTUnicodeRange object = a_object;
|
||||
if (this.m_start < object.m_start) {
|
||||
return -1;
|
||||
} else if (this.m_start == object.m_start) {
|
||||
return 0;
|
||||
} else
|
||||
return 1;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return m_block.toString();
|
||||
}
|
||||
|
||||
public long getStartCode() {
|
||||
return m_start;
|
||||
}
|
||||
|
||||
public long getEndCode() {
|
||||
return m_end;
|
||||
}
|
||||
|
||||
public int getOsTwoFlag() {
|
||||
return m_osTwoFlag;
|
||||
}
|
||||
|
||||
public int getCodeRangeFlag() {
|
||||
return m_codePageFlag;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,287 +1,286 @@
|
||||
/*
|
||||
* The Relaxer artifact
|
||||
* Copyright (c) 2000-2004, ASAMI Tomoharu, All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package org.doubletype.ossa.xml;
|
||||
|
||||
import java.util.*;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
/**
|
||||
* RStack
|
||||
*
|
||||
* @since Mar. 8, 2000
|
||||
* @version May. 22, 2003
|
||||
* @author ASAMI, Tomoharu (asami@relaxer.org)
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public final class RStack {
|
||||
private Element element_;
|
||||
private Object[] children_;
|
||||
// Set<String>
|
||||
// private HashSet consumedAttrs_ = new HashSet();
|
||||
// Set<Attr>
|
||||
private HashSet<Attr> consumedAttrNodes_ = null;
|
||||
// Set<Element>
|
||||
private HashSet<Attr> consumedElementNodes_ = null;
|
||||
// Map<String, String>
|
||||
private HashMap<String,String> pi_ = new HashMap<>();
|
||||
private int index_;
|
||||
// private Element lastPoppedElemnt_ = null;
|
||||
|
||||
protected RStack() {
|
||||
}
|
||||
|
||||
public RStack(Element element) {
|
||||
element_ = element;
|
||||
NodeList nodes = element.getChildNodes();
|
||||
List<Object> list = new ArrayList<>();
|
||||
_makeList(nodes, list);
|
||||
int size = list.size();
|
||||
children_ = new Object[size];
|
||||
children_ = list.toArray(children_);
|
||||
index_ = 0;
|
||||
}
|
||||
|
||||
private void _makeList(NodeList nodes, List<Object> list) {
|
||||
int size = nodes.getLength();
|
||||
StringBuffer buffer = null;
|
||||
for (int i = 0;i < size;i++) {
|
||||
Node node = nodes.item(i);
|
||||
if (node instanceof Element) {
|
||||
if (buffer != null) {
|
||||
list.add(new String(buffer));
|
||||
buffer = null;
|
||||
}
|
||||
list.add(node);
|
||||
} else if (node instanceof Text) {
|
||||
if (buffer == null) {
|
||||
buffer = new StringBuffer();
|
||||
}
|
||||
buffer.append(((Text)node).getData());
|
||||
} else if (node instanceof ProcessingInstruction) {
|
||||
ProcessingInstruction pi = (ProcessingInstruction)node;
|
||||
pi_.put(pi.getTarget(), pi.getData());
|
||||
} else if (node instanceof EntityReference) {
|
||||
_makeList(node.getChildNodes(), list);
|
||||
}
|
||||
}
|
||||
if (buffer != null) {
|
||||
list.add(new String(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
public Element getContextElement() {
|
||||
return (element_);
|
||||
}
|
||||
|
||||
/*
|
||||
public Element getLastPoppedElement() {
|
||||
return (lastPoppedElemnt_);
|
||||
}
|
||||
*/
|
||||
|
||||
public boolean isEmpty() {
|
||||
return (index_ == children_.length);
|
||||
}
|
||||
|
||||
public boolean isEmptyElement() {
|
||||
if (index_ == children_.length) {
|
||||
return (true);
|
||||
}
|
||||
for (int i = index_;i < children_.length;i++) {
|
||||
if (children_[i] instanceof Element) {
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
return (true);
|
||||
}
|
||||
|
||||
public Object pop() {
|
||||
return (children_[index_++]);
|
||||
}
|
||||
|
||||
public Object peek() {
|
||||
if (index_ == children_.length) {
|
||||
return (null);
|
||||
}
|
||||
return (children_[index_]);
|
||||
}
|
||||
|
||||
public Element popElement() {
|
||||
if (index_ == children_.length) {
|
||||
return (null);
|
||||
}
|
||||
while (index_ < children_.length) {
|
||||
Object node = children_[index_++];
|
||||
if (node instanceof Element) {
|
||||
// lastPoppedElemnt_ = (Element)node;
|
||||
// return (lastPoppedElemnt_);
|
||||
return ((Element)node);
|
||||
}
|
||||
}
|
||||
return (null);
|
||||
}
|
||||
|
||||
public Element peekElement() {
|
||||
if (index_ == children_.length) {
|
||||
return (null);
|
||||
}
|
||||
for (int i = index_;i < children_.length;i++) {
|
||||
Object node = children_[i];
|
||||
if (node instanceof Element) {
|
||||
return ((Element)node);
|
||||
}
|
||||
}
|
||||
return (null);
|
||||
}
|
||||
|
||||
public Element[] peekElements() {
|
||||
if (index_ == children_.length) {
|
||||
return (null);
|
||||
}
|
||||
List<Element> list = new ArrayList<>();
|
||||
for (int i = index_;i < children_.length;i++) {
|
||||
Object node = children_[i];
|
||||
if (node instanceof Element) {
|
||||
list.add((Element)node);
|
||||
}
|
||||
}
|
||||
Element[] elements = new Element[list.size()];
|
||||
return ((Element[])list.toArray(elements));
|
||||
}
|
||||
|
||||
/*
|
||||
public boolean hasAttributeHungry(String name) {
|
||||
if (isConsumedAttribute(name)) {
|
||||
return (false);
|
||||
}
|
||||
setCosumedAttribute(name);
|
||||
return (URelaxer.hasAttribute(element_, name));
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public boolean isConsumedAttribute(String name) {
|
||||
return (consumedAttrs_.contains(name));
|
||||
}
|
||||
|
||||
public boolean isConsumedAttribute(String uri, String name) {
|
||||
return (consumedAttrs_.contains(uri + "$" + name));
|
||||
}
|
||||
|
||||
public void setConsumedAttribute(String name) {
|
||||
if (isConsumedAttribute(name)) {
|
||||
throw (new InternalError());
|
||||
}
|
||||
consumedAttrs_.add(name);
|
||||
}
|
||||
|
||||
public void setConsumedAttribute(String uri, String name) {
|
||||
String fullname = uri + "$" + name;
|
||||
if (isConsumedAttribute(fullname)) {
|
||||
throw (new InternalError());
|
||||
}
|
||||
consumedAttrs_.add(fullname);
|
||||
}
|
||||
*/
|
||||
|
||||
public Map getPIMap() {
|
||||
return ((Map)pi_.clone());
|
||||
}
|
||||
|
||||
public boolean isConsumedElement(Attr attr) {
|
||||
if (consumedElementNodes_ == null) {
|
||||
return (false);
|
||||
}
|
||||
return (consumedElementNodes_.contains(attr));
|
||||
}
|
||||
|
||||
public void consumeElement(Attr attr) {
|
||||
if (consumedElementNodes_ == null) {
|
||||
consumedElementNodes_ = new HashSet<>();
|
||||
}
|
||||
consumedElementNodes_.add(attr);
|
||||
}
|
||||
|
||||
public boolean isConsumedAttribute(Attr attr) {
|
||||
if (consumedAttrNodes_ == null) {
|
||||
return (false);
|
||||
}
|
||||
return (consumedAttrNodes_.contains(attr));
|
||||
}
|
||||
|
||||
public void consumeAttribute(Attr attr) {
|
||||
if (attr == null) {
|
||||
return;
|
||||
}
|
||||
if (consumedAttrNodes_ == null) {
|
||||
consumedAttrNodes_ = new HashSet<>();
|
||||
}
|
||||
consumedAttrNodes_.add(attr);
|
||||
}
|
||||
|
||||
public void addDirectAttributes(Map<String,String> map) {
|
||||
NamedNodeMap attrs = element_.getAttributes();
|
||||
int size = attrs.getLength();
|
||||
for (int i = 0;i < size;i++) {
|
||||
Attr attr = (Attr)attrs.item(i);
|
||||
if (!isConsumedAttribute(attr)) {
|
||||
map.put(attr.getName(), attr.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public RStack makeClone() {
|
||||
RStack newStack = new RStack();
|
||||
newStack.element_ = element_;
|
||||
newStack.children_ = (Object[])children_.clone();
|
||||
if (consumedAttrNodes_ != null) {
|
||||
newStack.consumedAttrNodes_
|
||||
= (HashSet<Attr>)consumedAttrNodes_.clone();
|
||||
}
|
||||
if (consumedElementNodes_ != null) {
|
||||
newStack.consumedElementNodes_
|
||||
= (HashSet<Attr>)consumedElementNodes_.clone();
|
||||
}
|
||||
newStack.pi_ = (HashMap<String,String>)pi_.clone();
|
||||
newStack.index_ = index_;
|
||||
return (newStack);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("[");
|
||||
if (index_ < children_.length) {
|
||||
Object object = children_[index_];
|
||||
buffer.append(object);
|
||||
for (int i = index_ + 1;i < children_.length;i++) {
|
||||
buffer.append(",");
|
||||
object = children_[i];
|
||||
buffer.append(object);
|
||||
}
|
||||
}
|
||||
buffer.append("]");
|
||||
return (new String(buffer));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The Relaxer artifact
|
||||
* Copyright (c) 2000-2004, ASAMI Tomoharu, All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package org.doubletype.ossa.xml;
|
||||
|
||||
import java.util.*;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
/**
|
||||
* RStack
|
||||
*
|
||||
* @since Mar. 8, 2000
|
||||
* @version May. 22, 2003
|
||||
* @author ASAMI, Tomoharu (asami@relaxer.org)
|
||||
*/
|
||||
public final class RStack {
|
||||
private Element element_;
|
||||
private Object[] children_;
|
||||
// Set<String>
|
||||
// private HashSet consumedAttrs_ = new HashSet();
|
||||
// Set<Attr>
|
||||
private HashSet<Attr> consumedAttrNodes_ = null;
|
||||
// Set<Element>
|
||||
private HashSet<Attr> consumedElementNodes_ = null;
|
||||
// Map<String, String>
|
||||
private HashMap<String,String> pi_ = new HashMap<>();
|
||||
private int index_;
|
||||
// private Element lastPoppedElemnt_ = null;
|
||||
|
||||
protected RStack() {
|
||||
}
|
||||
|
||||
public RStack(Element element) {
|
||||
element_ = element;
|
||||
NodeList nodes = element.getChildNodes();
|
||||
List<Object> list = new ArrayList<>();
|
||||
_makeList(nodes, list);
|
||||
int size = list.size();
|
||||
children_ = new Object[size];
|
||||
children_ = list.toArray(children_);
|
||||
index_ = 0;
|
||||
}
|
||||
|
||||
private void _makeList(NodeList nodes, List<Object> list) {
|
||||
int size = nodes.getLength();
|
||||
StringBuffer buffer = null;
|
||||
for (int i = 0;i < size;i++) {
|
||||
Node node = nodes.item(i);
|
||||
if (node instanceof Element) {
|
||||
if (buffer != null) {
|
||||
list.add(new String(buffer));
|
||||
buffer = null;
|
||||
}
|
||||
list.add(node);
|
||||
} else if (node instanceof Text) {
|
||||
if (buffer == null) {
|
||||
buffer = new StringBuffer();
|
||||
}
|
||||
buffer.append(((Text)node).getData());
|
||||
} else if (node instanceof ProcessingInstruction) {
|
||||
ProcessingInstruction pi = (ProcessingInstruction)node;
|
||||
pi_.put(pi.getTarget(), pi.getData());
|
||||
} else if (node instanceof EntityReference) {
|
||||
_makeList(node.getChildNodes(), list);
|
||||
}
|
||||
}
|
||||
if (buffer != null) {
|
||||
list.add(new String(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
public Element getContextElement() {
|
||||
return (element_);
|
||||
}
|
||||
|
||||
/*
|
||||
public Element getLastPoppedElement() {
|
||||
return (lastPoppedElemnt_);
|
||||
}
|
||||
*/
|
||||
|
||||
public boolean isEmpty() {
|
||||
return (index_ == children_.length);
|
||||
}
|
||||
|
||||
public boolean isEmptyElement() {
|
||||
if (index_ == children_.length) {
|
||||
return (true);
|
||||
}
|
||||
for (int i = index_;i < children_.length;i++) {
|
||||
if (children_[i] instanceof Element) {
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
return (true);
|
||||
}
|
||||
|
||||
public Object pop() {
|
||||
return (children_[index_++]);
|
||||
}
|
||||
|
||||
public Object peek() {
|
||||
if (index_ == children_.length) {
|
||||
return (null);
|
||||
}
|
||||
return (children_[index_]);
|
||||
}
|
||||
|
||||
public Element popElement() {
|
||||
if (index_ == children_.length) {
|
||||
return (null);
|
||||
}
|
||||
while (index_ < children_.length) {
|
||||
Object node = children_[index_++];
|
||||
if (node instanceof Element) {
|
||||
// lastPoppedElemnt_ = (Element)node;
|
||||
// return (lastPoppedElemnt_);
|
||||
return ((Element)node);
|
||||
}
|
||||
}
|
||||
return (null);
|
||||
}
|
||||
|
||||
public Element peekElement() {
|
||||
if (index_ == children_.length) {
|
||||
return (null);
|
||||
}
|
||||
for (int i = index_;i < children_.length;i++) {
|
||||
Object node = children_[i];
|
||||
if (node instanceof Element) {
|
||||
return ((Element)node);
|
||||
}
|
||||
}
|
||||
return (null);
|
||||
}
|
||||
|
||||
public Element[] peekElements() {
|
||||
if (index_ == children_.length) {
|
||||
return (null);
|
||||
}
|
||||
List<Element> list = new ArrayList<>();
|
||||
for (int i = index_;i < children_.length;i++) {
|
||||
Object node = children_[i];
|
||||
if (node instanceof Element) {
|
||||
list.add((Element)node);
|
||||
}
|
||||
}
|
||||
Element[] elements = new Element[list.size()];
|
||||
return ((Element[])list.toArray(elements));
|
||||
}
|
||||
|
||||
/*
|
||||
public boolean hasAttributeHungry(String name) {
|
||||
if (isConsumedAttribute(name)) {
|
||||
return (false);
|
||||
}
|
||||
setCosumedAttribute(name);
|
||||
return (URelaxer.hasAttribute(element_, name));
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public boolean isConsumedAttribute(String name) {
|
||||
return (consumedAttrs_.contains(name));
|
||||
}
|
||||
|
||||
public boolean isConsumedAttribute(String uri, String name) {
|
||||
return (consumedAttrs_.contains(uri + "$" + name));
|
||||
}
|
||||
|
||||
public void setConsumedAttribute(String name) {
|
||||
if (isConsumedAttribute(name)) {
|
||||
throw (new InternalError());
|
||||
}
|
||||
consumedAttrs_.add(name);
|
||||
}
|
||||
|
||||
public void setConsumedAttribute(String uri, String name) {
|
||||
String fullname = uri + "$" + name;
|
||||
if (isConsumedAttribute(fullname)) {
|
||||
throw (new InternalError());
|
||||
}
|
||||
consumedAttrs_.add(fullname);
|
||||
}
|
||||
*/
|
||||
|
||||
public Map getPIMap() {
|
||||
return ((Map)pi_.clone());
|
||||
}
|
||||
|
||||
public boolean isConsumedElement(Attr attr) {
|
||||
if (consumedElementNodes_ == null) {
|
||||
return (false);
|
||||
}
|
||||
return (consumedElementNodes_.contains(attr));
|
||||
}
|
||||
|
||||
public void consumeElement(Attr attr) {
|
||||
if (consumedElementNodes_ == null) {
|
||||
consumedElementNodes_ = new HashSet<>();
|
||||
}
|
||||
consumedElementNodes_.add(attr);
|
||||
}
|
||||
|
||||
public boolean isConsumedAttribute(Attr attr) {
|
||||
if (consumedAttrNodes_ == null) {
|
||||
return (false);
|
||||
}
|
||||
return (consumedAttrNodes_.contains(attr));
|
||||
}
|
||||
|
||||
public void consumeAttribute(Attr attr) {
|
||||
if (attr == null) {
|
||||
return;
|
||||
}
|
||||
if (consumedAttrNodes_ == null) {
|
||||
consumedAttrNodes_ = new HashSet<>();
|
||||
}
|
||||
consumedAttrNodes_.add(attr);
|
||||
}
|
||||
|
||||
public void addDirectAttributes(Map<String,String> map) {
|
||||
NamedNodeMap attrs = element_.getAttributes();
|
||||
int size = attrs.getLength();
|
||||
for (int i = 0;i < size;i++) {
|
||||
Attr attr = (Attr)attrs.item(i);
|
||||
if (!isConsumedAttribute(attr)) {
|
||||
map.put(attr.getName(), attr.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public RStack makeClone() {
|
||||
RStack newStack = new RStack();
|
||||
newStack.element_ = element_;
|
||||
newStack.children_ = (Object[])children_.clone();
|
||||
if (consumedAttrNodes_ != null) {
|
||||
newStack.consumedAttrNodes_
|
||||
= (HashSet<Attr>)consumedAttrNodes_.clone();
|
||||
}
|
||||
if (consumedElementNodes_ != null) {
|
||||
newStack.consumedElementNodes_
|
||||
= (HashSet<Attr>)consumedElementNodes_.clone();
|
||||
}
|
||||
newStack.pi_ = (HashMap<String,String>)pi_.clone();
|
||||
newStack.index_ = index_;
|
||||
return (newStack);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("[");
|
||||
if (index_ < children_.length) {
|
||||
Object object = children_[index_];
|
||||
buffer.append(object);
|
||||
for (int i = index_ + 1;i < children_.length;i++) {
|
||||
buffer.append(",");
|
||||
object = children_[i];
|
||||
buffer.append(object);
|
||||
}
|
||||
}
|
||||
buffer.append("]");
|
||||
return (new String(buffer));
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,451 +1,450 @@
|
||||
/*
|
||||
* The Relaxer artifact
|
||||
* Copyright (c) 2000-2004, ASAMI Tomoharu, All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package org.doubletype.ossa.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Writer;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
/**
|
||||
* <b>XParamList</b> is generated from glyph.rng by Relaxer.
|
||||
* This class is derived from:
|
||||
*
|
||||
* <!-- for programmer
|
||||
* <define name="paramList">
|
||||
* <zeroOrMore>
|
||||
* <element name="param" ns="http://doubletype.org/ns/glyph/0.0">
|
||||
* <attribute name="name"/>
|
||||
* <data type="double"/>
|
||||
* </element>
|
||||
* </zeroOrMore>
|
||||
* </define>-->
|
||||
* <!-- for javadoc -->
|
||||
* <pre> <define name="paramList">
|
||||
* <zeroOrMore>
|
||||
* <element name="param" ns="http://doubletype.org/ns/glyph/0.0">
|
||||
* <attribute name="name"/>
|
||||
* <data type="double"/>
|
||||
* </element>
|
||||
* </zeroOrMore>
|
||||
* </define></pre>
|
||||
*
|
||||
* @version glyph.rng (Tue Nov 09 20:22:48 EST 2004)
|
||||
* @author Relaxer 1.1b (http://www.relaxer.org)
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class XParamList implements java.io.Serializable, Cloneable, IRNode {
|
||||
// List<XParamListParam>
|
||||
private java.util.List<XParamListParam> paramListParam_ = new java.util.ArrayList<>();
|
||||
private IRNode parentRNode_;
|
||||
|
||||
/**
|
||||
* Creates a <code>XParamList</code>.
|
||||
*
|
||||
*/
|
||||
public XParamList() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <code>XParamList</code>.
|
||||
*
|
||||
* @param source
|
||||
*/
|
||||
public XParamList(XParamList source) {
|
||||
setup(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <code>XParamList</code> by the Stack <code>stack</code>
|
||||
* that contains Elements.
|
||||
* This constructor is supposed to be used internally
|
||||
* by the Relaxer system.
|
||||
*
|
||||
* @param stack
|
||||
*/
|
||||
public XParamList(RStack stack) {
|
||||
setup(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the <code>XParamList</code> by the XParamList <code>source</code>.
|
||||
*
|
||||
* @param source
|
||||
*/
|
||||
public void setup(XParamList source) {
|
||||
int size;
|
||||
this.paramListParam_.clear();
|
||||
size = source.paramListParam_.size();
|
||||
for (int i = 0;i < size;i++) {
|
||||
addParamListParam((XParamListParam)source.getParamListParam(i).clone());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the <code>XParamList</code> by the Stack <code>stack</code>
|
||||
* that contains Elements.
|
||||
* This constructor is supposed to be used internally
|
||||
* by the Relaxer system.
|
||||
*
|
||||
* @param stack
|
||||
*/
|
||||
public void setup(RStack stack) {
|
||||
Element element = stack.getContextElement();
|
||||
IGlyphFactory factory = GlyphFactory.getFactory();
|
||||
paramListParam_.clear();
|
||||
while (true) {
|
||||
if (XParamListParam.isMatch(stack)) {
|
||||
addParamListParam(factory.createXParamListParam(stack));
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Object
|
||||
*/
|
||||
public Object clone() {
|
||||
IGlyphFactory factory = GlyphFactory.getFactory();
|
||||
return (factory.createXParamList((XParamList)this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a DOM representation of the object.
|
||||
* Result is appended to the Node <code>parent</code>.
|
||||
*
|
||||
* @param parent
|
||||
*/
|
||||
public void makeElement(Node parent) {
|
||||
Document doc = parent.getOwnerDocument();
|
||||
Element element = (Element)parent;
|
||||
int size;
|
||||
size = this.paramListParam_.size();
|
||||
for (int i = 0;i < size;i++) {
|
||||
XParamListParam value = (XParamListParam)this.paramListParam_.get(i);
|
||||
value.makeElement(element);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
* @return XParamListParam[]
|
||||
*/
|
||||
public XParamListParam[] getParamListParam() {
|
||||
XParamListParam[] array = new XParamListParam[paramListParam_.size()];
|
||||
return ((XParamListParam[])paramListParam_.toArray(array));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void setParamListParam(XParamListParam[] paramListParam) {
|
||||
this.paramListParam_.clear();
|
||||
for (int i = 0;i < paramListParam.length;i++) {
|
||||
addParamListParam(paramListParam[i]);
|
||||
}
|
||||
for (int i = 0;i < paramListParam.length;i++) {
|
||||
paramListParam[i].rSetParentRNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void setParamListParam(XParamListParam paramListParam) {
|
||||
this.paramListParam_.clear();
|
||||
addParamListParam(paramListParam);
|
||||
if (paramListParam != null) {
|
||||
paramListParam.rSetParentRNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void addParamListParam(XParamListParam paramListParam) {
|
||||
this.paramListParam_.add(paramListParam);
|
||||
if (paramListParam != null) {
|
||||
paramListParam.rSetParentRNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void addParamListParam(XParamListParam[] paramListParam) {
|
||||
for (int i = 0;i < paramListParam.length;i++) {
|
||||
addParamListParam(paramListParam[i]);
|
||||
}
|
||||
for (int i = 0;i < paramListParam.length;i++) {
|
||||
paramListParam[i].rSetParentRNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets number of the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public int sizeParamListParam() {
|
||||
return (paramListParam_.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the XParamListParam property <b>paramListParam</b> by index.
|
||||
*
|
||||
* @param index
|
||||
* @return XParamListParam
|
||||
*/
|
||||
public XParamListParam getParamListParam(int index) {
|
||||
return ((XParamListParam)paramListParam_.get(index));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the XParamListParam property <b>paramListParam</b> by index.
|
||||
*
|
||||
* @param index
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void setParamListParam(int index, XParamListParam paramListParam) {
|
||||
this.paramListParam_.set(index, paramListParam);
|
||||
if (paramListParam != null) {
|
||||
paramListParam.rSetParentRNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the XParamListParam property <b>paramListParam</b> by index.
|
||||
*
|
||||
* @param index
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void addParamListParam(int index, XParamListParam paramListParam) {
|
||||
this.paramListParam_.add(index, paramListParam);
|
||||
if (paramListParam != null) {
|
||||
paramListParam.rSetParentRNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the XParamListParam property <b>paramListParam</b> by index.
|
||||
*
|
||||
* @param index
|
||||
*/
|
||||
public void removeParamListParam(int index) {
|
||||
this.paramListParam_.remove(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the XParamListParam property <b>paramListParam</b> by object.
|
||||
*
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void removeParamListParam(XParamListParam paramListParam) {
|
||||
this.paramListParam_.remove(paramListParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
*/
|
||||
public void clearParamListParam() {
|
||||
this.paramListParam_.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String makeTextDocument() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
makeTextElement(buffer);
|
||||
return (new String(buffer));
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
public void makeTextElement(StringBuffer buffer) {
|
||||
int size;
|
||||
size = this.paramListParam_.size();
|
||||
for (int i = 0;i < size;i++) {
|
||||
XParamListParam value = (XParamListParam)this.paramListParam_.get(i);
|
||||
value.makeTextElement(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @param buffer
|
||||
* @exception IOException
|
||||
*/
|
||||
public void makeTextElement(Writer buffer) throws IOException {
|
||||
int size;
|
||||
size = this.paramListParam_.size();
|
||||
for (int i = 0;i < size;i++) {
|
||||
XParamListParam value = (XParamListParam)this.paramListParam_.get(i);
|
||||
value.makeTextElement(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
public void makeTextElement(PrintWriter buffer) {
|
||||
int size;
|
||||
size = this.paramListParam_.size();
|
||||
for (int i = 0;i < size;i++) {
|
||||
XParamListParam value = (XParamListParam)this.paramListParam_.get(i);
|
||||
value.makeTextElement(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
public void makeTextAttribute(StringBuffer buffer) {
|
||||
int size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @param buffer
|
||||
* @exception IOException
|
||||
*/
|
||||
public void makeTextAttribute(Writer buffer) throws IOException {
|
||||
int size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
public void makeTextAttribute(PrintWriter buffer) {
|
||||
int size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of this object.
|
||||
* While this method informs as XML format representaion,
|
||||
* it's purpose is just information, not making
|
||||
* a rigid XML documentation.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String toString() {
|
||||
try {
|
||||
return (makeTextDocument());
|
||||
} catch (Exception e) {
|
||||
return (super.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the IRNode property <b>parentRNode</b>.
|
||||
*
|
||||
* @return IRNode
|
||||
*/
|
||||
public IRNode rGetParentRNode() {
|
||||
return (parentRNode_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the IRNode property <b>parentRNode</b>.
|
||||
*
|
||||
* @param parentRNode
|
||||
*/
|
||||
public void rSetParentRNode(IRNode parentRNode) {
|
||||
this.parentRNode_ = parentRNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets child RNodes.
|
||||
*
|
||||
* @return IRNode[]
|
||||
*/
|
||||
public IRNode[] rGetRNodes() {
|
||||
java.util.List<IRNode> classNodes = new java.util.ArrayList<>();
|
||||
classNodes.addAll(paramListParam_);
|
||||
IRNode[] nodes = new IRNode[classNodes.size()];
|
||||
return ((IRNode[])classNodes.toArray(nodes));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if elements contained in a Stack <code>stack</code>
|
||||
* is valid for the <code>XParamList</code>.
|
||||
* This mehtod is supposed to be used internally
|
||||
* by the Relaxer system.
|
||||
*
|
||||
* @param stack
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isMatch(RStack stack) {
|
||||
return (isMatchHungry(stack.makeClone()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if elements contained in a Stack <code>stack</code>
|
||||
* is valid for the <code>XParamList</code>.
|
||||
* This method consumes the stack contents during matching operation.
|
||||
* This mehtod is supposed to be used internally
|
||||
* by the Relaxer system.
|
||||
*
|
||||
* @param stack
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isMatchHungry(RStack stack) {
|
||||
RStack target = stack;
|
||||
boolean $match$ = false;
|
||||
Element element = stack.peekElement();
|
||||
IGlyphFactory factory = GlyphFactory.getFactory();
|
||||
Element child;
|
||||
while (true) {
|
||||
if (!XParamListParam.isMatchHungry(target)) {
|
||||
break;
|
||||
}
|
||||
$match$ = true;
|
||||
}
|
||||
return ($match$);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The Relaxer artifact
|
||||
* Copyright (c) 2000-2004, ASAMI Tomoharu, All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package org.doubletype.ossa.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Writer;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
/**
|
||||
* <b>XParamList</b> is generated from glyph.rng by Relaxer.
|
||||
* This class is derived from:
|
||||
*
|
||||
* <!-- for programmer
|
||||
* <define name="paramList">
|
||||
* <zeroOrMore>
|
||||
* <element name="param" ns="http://doubletype.org/ns/glyph/0.0">
|
||||
* <attribute name="name"/>
|
||||
* <data type="double"/>
|
||||
* </element>
|
||||
* </zeroOrMore>
|
||||
* </define>-->
|
||||
* <!-- for javadoc -->
|
||||
* <pre> <define name="paramList">
|
||||
* <zeroOrMore>
|
||||
* <element name="param" ns="http://doubletype.org/ns/glyph/0.0">
|
||||
* <attribute name="name"/>
|
||||
* <data type="double"/>
|
||||
* </element>
|
||||
* </zeroOrMore>
|
||||
* </define></pre>
|
||||
*
|
||||
* @version glyph.rng (Tue Nov 09 20:22:48 EST 2004)
|
||||
* @author Relaxer 1.1b (http://www.relaxer.org)
|
||||
*/
|
||||
public class XParamList implements java.io.Serializable, Cloneable, IRNode {
|
||||
// List<XParamListParam>
|
||||
private java.util.List<XParamListParam> paramListParam_ = new java.util.ArrayList<>();
|
||||
private IRNode parentRNode_;
|
||||
|
||||
/**
|
||||
* Creates a <code>XParamList</code>.
|
||||
*
|
||||
*/
|
||||
public XParamList() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <code>XParamList</code>.
|
||||
*
|
||||
* @param source
|
||||
*/
|
||||
public XParamList(XParamList source) {
|
||||
setup(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <code>XParamList</code> by the Stack <code>stack</code>
|
||||
* that contains Elements.
|
||||
* This constructor is supposed to be used internally
|
||||
* by the Relaxer system.
|
||||
*
|
||||
* @param stack
|
||||
*/
|
||||
public XParamList(RStack stack) {
|
||||
setup(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the <code>XParamList</code> by the XParamList <code>source</code>.
|
||||
*
|
||||
* @param source
|
||||
*/
|
||||
public void setup(XParamList source) {
|
||||
int size;
|
||||
this.paramListParam_.clear();
|
||||
size = source.paramListParam_.size();
|
||||
for (int i = 0;i < size;i++) {
|
||||
addParamListParam((XParamListParam)source.getParamListParam(i).clone());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the <code>XParamList</code> by the Stack <code>stack</code>
|
||||
* that contains Elements.
|
||||
* This constructor is supposed to be used internally
|
||||
* by the Relaxer system.
|
||||
*
|
||||
* @param stack
|
||||
*/
|
||||
public void setup(RStack stack) {
|
||||
Element element = stack.getContextElement();
|
||||
IGlyphFactory factory = GlyphFactory.getFactory();
|
||||
paramListParam_.clear();
|
||||
while (true) {
|
||||
if (XParamListParam.isMatch(stack)) {
|
||||
addParamListParam(factory.createXParamListParam(stack));
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Object
|
||||
*/
|
||||
public Object clone() {
|
||||
IGlyphFactory factory = GlyphFactory.getFactory();
|
||||
return (factory.createXParamList((XParamList)this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a DOM representation of the object.
|
||||
* Result is appended to the Node <code>parent</code>.
|
||||
*
|
||||
* @param parent
|
||||
*/
|
||||
public void makeElement(Node parent) {
|
||||
Document doc = parent.getOwnerDocument();
|
||||
Element element = (Element)parent;
|
||||
int size;
|
||||
size = this.paramListParam_.size();
|
||||
for (int i = 0;i < size;i++) {
|
||||
XParamListParam value = (XParamListParam)this.paramListParam_.get(i);
|
||||
value.makeElement(element);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
* @return XParamListParam[]
|
||||
*/
|
||||
public XParamListParam[] getParamListParam() {
|
||||
XParamListParam[] array = new XParamListParam[paramListParam_.size()];
|
||||
return ((XParamListParam[])paramListParam_.toArray(array));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void setParamListParam(XParamListParam[] paramListParam) {
|
||||
this.paramListParam_.clear();
|
||||
for (int i = 0;i < paramListParam.length;i++) {
|
||||
addParamListParam(paramListParam[i]);
|
||||
}
|
||||
for (int i = 0;i < paramListParam.length;i++) {
|
||||
paramListParam[i].rSetParentRNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void setParamListParam(XParamListParam paramListParam) {
|
||||
this.paramListParam_.clear();
|
||||
addParamListParam(paramListParam);
|
||||
if (paramListParam != null) {
|
||||
paramListParam.rSetParentRNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void addParamListParam(XParamListParam paramListParam) {
|
||||
this.paramListParam_.add(paramListParam);
|
||||
if (paramListParam != null) {
|
||||
paramListParam.rSetParentRNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void addParamListParam(XParamListParam[] paramListParam) {
|
||||
for (int i = 0;i < paramListParam.length;i++) {
|
||||
addParamListParam(paramListParam[i]);
|
||||
}
|
||||
for (int i = 0;i < paramListParam.length;i++) {
|
||||
paramListParam[i].rSetParentRNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets number of the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public int sizeParamListParam() {
|
||||
return (paramListParam_.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the XParamListParam property <b>paramListParam</b> by index.
|
||||
*
|
||||
* @param index
|
||||
* @return XParamListParam
|
||||
*/
|
||||
public XParamListParam getParamListParam(int index) {
|
||||
return ((XParamListParam)paramListParam_.get(index));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the XParamListParam property <b>paramListParam</b> by index.
|
||||
*
|
||||
* @param index
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void setParamListParam(int index, XParamListParam paramListParam) {
|
||||
this.paramListParam_.set(index, paramListParam);
|
||||
if (paramListParam != null) {
|
||||
paramListParam.rSetParentRNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the XParamListParam property <b>paramListParam</b> by index.
|
||||
*
|
||||
* @param index
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void addParamListParam(int index, XParamListParam paramListParam) {
|
||||
this.paramListParam_.add(index, paramListParam);
|
||||
if (paramListParam != null) {
|
||||
paramListParam.rSetParentRNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the XParamListParam property <b>paramListParam</b> by index.
|
||||
*
|
||||
* @param index
|
||||
*/
|
||||
public void removeParamListParam(int index) {
|
||||
this.paramListParam_.remove(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the XParamListParam property <b>paramListParam</b> by object.
|
||||
*
|
||||
* @param paramListParam
|
||||
*/
|
||||
public void removeParamListParam(XParamListParam paramListParam) {
|
||||
this.paramListParam_.remove(paramListParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the XParamListParam property <b>paramListParam</b>.
|
||||
*
|
||||
*/
|
||||
public void clearParamListParam() {
|
||||
this.paramListParam_.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String makeTextDocument() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
makeTextElement(buffer);
|
||||
return (new String(buffer));
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
public void makeTextElement(StringBuffer buffer) {
|
||||
int size;
|
||||
size = this.paramListParam_.size();
|
||||
for (int i = 0;i < size;i++) {
|
||||
XParamListParam value = (XParamListParam)this.paramListParam_.get(i);
|
||||
value.makeTextElement(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @param buffer
|
||||
* @exception IOException
|
||||
*/
|
||||
public void makeTextElement(Writer buffer) throws IOException {
|
||||
int size;
|
||||
size = this.paramListParam_.size();
|
||||
for (int i = 0;i < size;i++) {
|
||||
XParamListParam value = (XParamListParam)this.paramListParam_.get(i);
|
||||
value.makeTextElement(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
public void makeTextElement(PrintWriter buffer) {
|
||||
int size;
|
||||
size = this.paramListParam_.size();
|
||||
for (int i = 0;i < size;i++) {
|
||||
XParamListParam value = (XParamListParam)this.paramListParam_.get(i);
|
||||
value.makeTextElement(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
public void makeTextAttribute(StringBuffer buffer) {
|
||||
int size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @param buffer
|
||||
* @exception IOException
|
||||
*/
|
||||
public void makeTextAttribute(Writer buffer) throws IOException {
|
||||
int size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an XML text representation.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
public void makeTextAttribute(PrintWriter buffer) {
|
||||
int size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of this object.
|
||||
* While this method informs as XML format representaion,
|
||||
* it's purpose is just information, not making
|
||||
* a rigid XML documentation.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String toString() {
|
||||
try {
|
||||
return (makeTextDocument());
|
||||
} catch (Exception e) {
|
||||
return (super.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the IRNode property <b>parentRNode</b>.
|
||||
*
|
||||
* @return IRNode
|
||||
*/
|
||||
public IRNode rGetParentRNode() {
|
||||
return (parentRNode_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the IRNode property <b>parentRNode</b>.
|
||||
*
|
||||
* @param parentRNode
|
||||
*/
|
||||
public void rSetParentRNode(IRNode parentRNode) {
|
||||
this.parentRNode_ = parentRNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets child RNodes.
|
||||
*
|
||||
* @return IRNode[]
|
||||
*/
|
||||
public IRNode[] rGetRNodes() {
|
||||
java.util.List<IRNode> classNodes = new java.util.ArrayList<>();
|
||||
classNodes.addAll(paramListParam_);
|
||||
IRNode[] nodes = new IRNode[classNodes.size()];
|
||||
return ((IRNode[])classNodes.toArray(nodes));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if elements contained in a Stack <code>stack</code>
|
||||
* is valid for the <code>XParamList</code>.
|
||||
* This mehtod is supposed to be used internally
|
||||
* by the Relaxer system.
|
||||
*
|
||||
* @param stack
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isMatch(RStack stack) {
|
||||
return (isMatchHungry(stack.makeClone()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if elements contained in a Stack <code>stack</code>
|
||||
* is valid for the <code>XParamList</code>.
|
||||
* This method consumes the stack contents during matching operation.
|
||||
* This mehtod is supposed to be used internally
|
||||
* by the Relaxer system.
|
||||
*
|
||||
* @param stack
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isMatchHungry(RStack stack) {
|
||||
RStack target = stack;
|
||||
boolean $match$ = false;
|
||||
Element element = stack.peekElement();
|
||||
IGlyphFactory factory = GlyphFactory.getFactory();
|
||||
Element child;
|
||||
while (true) {
|
||||
if (!XParamListParam.isMatchHungry(target)) {
|
||||
break;
|
||||
}
|
||||
$match$ = true;
|
||||
}
|
||||
return ($match$);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user