You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by to...@apache.org on 2007/06/19 10:46:29 UTC
svn commit: r548654 [1/2] - in
/harmony/enhanced/classlib/branches/java6/modules: awt/
awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/
awt/src/main/native/fontlib/ awt/src/main/native/fontlib/shared/
awt/src/main/native/fontlib/shared/...
Author: tonywu
Date: Tue Jun 19 01:46:27 2007
New Revision: 548654
URL: http://svn.apache.org/viewvc?view=rev&rev=548654
Log:
Merge updates from classlib trunk@548382 since 547786
Added:
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TypeDefinition.cpp
- copied unchanged from r548382, harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TypeDefinition.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TypeDefinition.h
- copied unchanged from r548382, harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TypeDefinition.h
harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/resources/serialization/org/apache/harmony/jndi/tests/javax/naming/ldap/TestSortResponseControl.golden.ser
- copied unchanged from r548382, harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/harmony/jndi/tests/javax/naming/ldap/TestSortResponseControl.golden.ser
Removed:
harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/GenericURLDirContext.java
Modified:
harmony/enhanced/classlib/branches/java6/modules/awt/build.xml
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLFontManager.java
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/ (props changed)
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/AGL.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/EncodedValue.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Environment.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Environment.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Glyph.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Glyph.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Outline.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Outline.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/ParsingTables.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Font.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Font.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Glyph.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Glyph.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTCurve.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTCurve.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTFont.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/TTFont.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Tables.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Type1Structs.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/fljni.cpp
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/include/fljni.h
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/unix/ (props changed)
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/unix/makefile
harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/windows/makefile
harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/ldap/SortResponseControl.java
harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java
harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.java
harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResolverCache.java
harmony/enhanced/classlib/branches/java6/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java
harmony/enhanced/classlib/branches/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestSortResponseControl.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedOutputStream.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/BufferedWriter.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TreeMap.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/BufferedOutputStreamTest.java
harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/BufferedWriterTest.java
harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/ (props changed)
harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/ (props changed)
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/build.xml?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/build.xml Tue Jun 19 01:46:27 2007
@@ -138,7 +138,7 @@
</target>
<target name="build-native"
- depends="-build-native-unix,-build-native-windows,-build-native-x86">
+ depends="-build-native-unix,-build-native-windows">
<make dir="${hy.awt.src.main.native}/lcmm/${hy.os.family}" />
<!-- Copy the built shared libs over to the jre/bin dir -->
<copy todir="${hy.jdk}/jre/bin" overwrite="yes">
@@ -178,6 +178,16 @@
<exclude name="*${manifest.suffix}"/>
</fileset>
</copy>
+
+ <make dir="${hy.awt.src.main.native}/fontlib/${hy.os.family}" />
+ <!-- Copy the built shared libs over to the jre/bin dir -->
+ <copy todir="${hy.jdk}/jre/bin" overwrite="yes">
+ <fileset dir="${hy.awt.src.main.native}/fontlib">
+ <include name="*${shlib.suffix}*"/>
+ <include name="*${progdb.suffix}*" if="is.windows" />
+ <exclude name="*${manifest.suffix}"/>
+ </fileset>
+ </copy>
</target>
<target name="-build-native-unix" if="is.unix">
@@ -215,18 +225,6 @@
<fileset dir="${hy.awt.src.main.native}/winfont">
<include name="*${shlib.suffix}*"/>
<include name="*${progdb.suffix}*" />
- <exclude name="*${manifest.suffix}"/>
- </fileset>
- </copy>
- </target>
-
- <target name="-build-native-x86" if="is.x86">
- <make dir="${hy.awt.src.main.native}/fontlib/${hy.os.family}" />
- <!-- Copy the built shared libs over to the jre/bin dir -->
- <copy todir="${hy.jdk}/jre/bin" overwrite="yes">
- <fileset dir="${hy.awt.src.main.native}/fontlib">
- <include name="*${shlib.suffix}*"/>
- <include name="*${progdb.suffix}*" if="is.windows" />
<exclude name="*${manifest.suffix}"/>
</fileset>
</copy>
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLFontManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLFontManager.java?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLFontManager.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLFontManager.java Tue Jun 19 01:46:27 2007
@@ -43,7 +43,7 @@
public FLFontManager() {
Runtime.getRuntime().addShutdownHook(new DisposeNativeHook());
-
+
initManager();
addPath(new File(System.getProperty("java.home") + "/lib/fonts/"));
@@ -82,7 +82,7 @@
Font newFont;
for (int i = 0; i < strMas.length; i++) {
- String str = strMas[i].substring(strMas[i].length() - 3).toLowerCase();
+ String str = strMas[i].substring(strMas[i].length() - 3).toLowerCase();
newFont = addFont(dir + "/" + strMas[i], str.equals("ttf") ? Font.TRUETYPE_FONT : Font.TYPE1_FONT);
if (newFont != null) {
Propchange: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 19 01:46:27 2007
@@ -1,3 +1,4 @@
*.dll
*.map
*.pdb
+libFL.so
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/AGL.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/AGL.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/AGL.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/AGL.h Tue Jun 19 01:46:27 2007
@@ -17,9 +17,11 @@
#ifndef __TYPE_1_FL_TREE_H
#define __TYPE_1_FL_TREE_H
-static const unsigned short FONT_NOT_FOUND_UNICODE_VALUE = 0xffff;
+#include "TypeDefinition.h"
-static const unsigned char GLYPH_LIST[64323] = {
+static const ufshort FONT_NOT_FOUND_UNICODE_VALUE = 0xffff;
+
+static const ufchar GLYPH_LIST[64323] = {
193, 0, 65, 0, 7,248,220,194, 0, 66, 0, 14,248, 61,195, 0,
67, 0, 21,246,122,196, 0, 68, 0, 28,244,196,197, 0, 69, 0,
35,241,128,198, 0, 70, 0, 42,240,246,199, 0, 71, 0, 49,239,
@@ -4042,7 +4044,7 @@
111,238, 1,226,251, 56, 0, 0,115,109, 97,108,236,247,230, 0,
0, 0, 0};
-static const unsigned short STANDART_ENCODING[256] = {
+static const ufshort STANDART_ENCODING[256] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/EncodedValue.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/EncodedValue.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/EncodedValue.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/EncodedValue.h Tue Jun 19 01:46:27 2007
@@ -21,14 +21,16 @@
#ifndef __TYPE_1_ENCODED_VALUE_CLASS_H
#define __TYPE_1_ENCODED_VALUE_CLASS_H
+#include "TypeDefinition.h"
+
class EncodedValue {
public:
EncodedValue(void);
~EncodedValue(void);
- unsigned short number;
- unsigned short length;
- char* text;
+ ufshort number;
+ ufshort length;
+ fchar* text;
};
#endif //__TYPE_1_ENCODED_VALUE_CLASS_H
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Environment.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Environment.cpp?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Environment.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Environment.cpp Tue Jun 19 01:46:27 2007
@@ -37,7 +37,7 @@
//static bool getFonts = false;//true;
//#endif
-int Environment::_length = 0;
+fint Environment::_length = 0;
FontHeader::FontHeader()
{
@@ -48,7 +48,7 @@
_head = NULL;
}
-FontHeader::FontHeader(char** filePath, FontType fType)
+FontHeader::FontHeader(fchar** filePath, FontType fType)
{
_filePath = *filePath;
_familyName = NULL;
@@ -60,20 +60,20 @@
FontHeader::~FontHeader()
{
- //printf("now = %s , %u \n", (char *)_filePath, _fType);
+ //printf("now = %s , %u \n", (fchar *)_filePath, _fType);
delete _familyName;
delete _filePath;
//delete _font;
delete _nextHeader;
}
-bool fntType(char* font, char* type)
+bool fntType(fchar* font, fchar* type)
{
bool ret=0;
- unsigned char j=0;
+ ufchar j=0;
- int len = (int)strlen(font);
- for (int i = 0; i<=len; i++)
+ fint len = (fint)strlen(font);
+ for (fint i = 0; i<=len; i++)
{
if (tolower(font[i]) == tolower(type[j]))
{
@@ -89,9 +89,9 @@
return ret;
}
-void static inline getNewLexeme(char* str, FILE* font) {
- unsigned char ch;
- unsigned short count = 0;
+void static inline getNewLexeme(fchar* str, FILE* font) {
+ ufchar ch;
+ ufshort count = 0;
while (!feof(font) && ((ch = getc(font)) == ' ' || ch == '\n' || ch == '\r')) {
}
@@ -104,12 +104,12 @@
str[count] = '\0';
}
-int static inline getT1Name(char *pathToFile,wchar_t** fontFamilyName, StyleName* style) {
+fint static inline getT1Name(fchar *pathToFile,fwchar_t** fontFamilyName, StyleName* style) {
FILE *font;
- char curStr[1024];
- char *ptr;
- unsigned char ch;
+ fchar curStr[1024];
+ fchar *ptr;
+ ufchar ch;
if( font = fopen(pathToFile, "rb")) {
@@ -137,7 +137,7 @@
getNewLexeme(curStr, font);
if (!strcmp(curStr, "/FamilyName")) {
- unsigned short count = 0;
+ ufshort count = 0;
while (!feof(font) && ((ch = getc(font)) == '(')) {
}
@@ -153,7 +153,7 @@
//printf("fontFamilyName = ");
ch = 0;
- *fontFamilyName = new wchar_t[count + 1];
+ *fontFamilyName = new fwchar_t[count + 1];
while (*ptr != '\0') {
(*fontFamilyName)[ch ++] = *ptr;
//printf("%c", *ptr);
@@ -187,7 +187,7 @@
} else if (!strcmp(curStr, "/ItalicAngle")) {
getNewLexeme(curStr, font);
- double italicAngle = atof(curStr);
+ fdouble italicAngle = atof(curStr);
if (italicAngle) {
//printf("\n%f\n",italicAngle);
if (*style == Bold) {
@@ -209,11 +209,11 @@
return -1;
}
-FontHeader* addFontFile(char** file, FontType ft)
+FontHeader* addFontFile(fchar** file, FontType ft)
{
FILE* ttfile;
StyleName* fStyle;
- int result;
+ fint result;
FontHeader *fh = new FontHeader(file, ft);
@@ -268,34 +268,34 @@
return fh;
}
-/*static inline FontHeader* add( char* name, char* dir, FontType ft)
+/*static inline FontHeader* add( fchar* name, fchar* dir, FontType ft)
{
- int len = (int)strlen(dir);
- char* fontFile = new char[len+strlen(name)+1];
+ fint len = (fint)strlen(dir);
+ fchar* fontFile = new fchar[len+strlen(name)+1];
strncpy(fontFile, dir, len+1);
strcat(fontFile, name);
return addFontFile(&fontFile, ft);
}*/
-FontHeader* Environment::addFile(char* file, FontType ft)
+FontHeader* Environment::addFile(fchar* file, FontType ft)
{
- int len = (int)strlen(file);
- char* filepath = new char[len+1];
+ fint len = (fint)strlen(file);
+ fchar* filepath = new fchar[len+1];
strcpy(filepath,file);
return addFontFile(&filepath, ft);
}
-/*int Environment::addPath(char* argPath)
+/*fint Environment::addPath(fchar* argPath)
{
- char* tok;
- char fDir[1024];
+ fchar* tok;
+ fchar fDir[1024];
- char deLimits[] = " ;";
- char currentDir[1024];
- long hFile;
+ fchar deLimits[] = " ;";
+ fchar currentDir[1024];
+ flong hFile;
- char path[1024];
+ fchar path[1024];
strcpy(path,argPath);
tok = strtok(path, deLimits);
@@ -308,7 +308,7 @@
#ifdef WIN32
struct _finddata_t font_file;
- if( (hFile = (long)_findfirst( currentDir, &font_file )) != -1L )
+ if( (hFile = (flong)_findfirst( currentDir, &font_file )) != -1L )
// printf("No available fonts in %s\n", currentDir);
// else
{
@@ -330,7 +330,7 @@
globbuf.gl_offs = 5;
glob(currentDir, GLOB_NOSORT, NULL, &globbuf);
- for(char** filesList = globbuf.gl_pathv; *filesList != NULL; filesList++)
+ for(fchar** filesList = globbuf.gl_pathv; *filesList != NULL; filesList++)
{
if (fntType(*filesList,".ttf"))
addFontFile(filesList, TrueType);
@@ -354,8 +354,8 @@
/*if (getFonts)
{
#ifdef WIN32
- char* WINFONTS = "\\Fonts\\";
- char winDir[256];
+ fchar* WINFONTS = "\\Fonts\\";
+ fchar winDir[256];
strcpy(winDir,getenv("windir"));
strcat(winDir,WINFONTS);
addPath(winDir);
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Environment.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Environment.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Environment.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Environment.h Tue Jun 19 01:46:27 2007
@@ -22,6 +22,7 @@
#define __GRAPHICS_ENVIRONMENT_H__
#include "Font.h"
+#include "TypeDefinition.h"
typedef enum FontTypeTag {
TrueType = 0,
@@ -30,8 +31,8 @@
class FontHeader
{
public:
- wchar_t *_familyName;
- char* _filePath;
+ fwchar_t *_familyName;
+ fchar* _filePath;
StyleName _style;
Font* _font;
FontType _fType;
@@ -39,7 +40,7 @@
FontHeader* _head;
FontHeader();
- FontHeader(char** filePath, FontType fType);
+ FontHeader(fchar** filePath, FontType fType);
~FontHeader();
};
@@ -47,9 +48,9 @@
class Environment
{
public:
- static int _length; //length of list
- static int addPath(char* argPath);
- static FontHeader* addFile(char* argPath, FontType ft);
+ static fint _length; //length of list
+// static fint addPath(fchar* argPath);
+ static FontHeader* addFile(fchar* argPath, FontType ft);
static FontHeader* getAllFonts();
};
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.cpp?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.cpp Tue Jun 19 01:46:27 2007
@@ -28,16 +28,16 @@
}
Font::~Font() {
- for( std::map<const unsigned long, Glyph*>::iterator iter = _glyphMap.begin(); iter != _glyphMap.end(); iter++ ) {
+ for( std::map<const uflong, Glyph*>::iterator iter = _glyphMap.begin(); iter != _glyphMap.end(); iter++ ) {
delete iter->second;
}
delete[] _famName;
- /*unsigned short famLength = wcslen((wchar_t *)_famName);
- char *family = new char[famLength+1];
+ /*ufshort famLength = fwcslen((fwchar_t *)_famName);
+ fchar *family = new fchar[famLength+1];
- unsigned short i;
+ ufshort i;
for (i = 0;i < famLength;i++) {
(family)[i] = _famName[i];
}
@@ -45,7 +45,7 @@
FontHeader* fh = GraphicsEnvironment::getAllFonts()->_head;
//printf("\nfaund = -%s-\n", family);
- for(int i=0; i<GraphicsEnvironment::_length; i++){
+ for(fint i=0; i<GraphicsEnvironment::_length; i++){
//printf("font = -%s-\n", fh->_familyName);
if (strcmp(fh->_familyName,family)==0 && fh->_style == _style) {
fh->_font = NULL;
@@ -58,51 +58,51 @@
delete[] family;*/
}
-Glyph* Font::createGlyph(unsigned short unicode, unsigned short size){
+Glyph* Font::createGlyph(ufshort unicode, ufshort size){
return NULL;
}
-wchar_t* Font::getPSName()
+fwchar_t* Font::getPSName()
{
return NULL;
}
-float* Font::getLineMetrics()
+ffloat* Font::getLineMetrics()
{
return NULL;
}
-int Font::getMissingGlyphCode()
+fint Font::getMissingGlyphCode()
{
return 0;
}
-bool Font::canDisplay(unsigned short c)
+bool Font::canDisplay(ufshort c)
{
return NULL;
}
-unsigned short Font::getUnicodeByIndex(unsigned short ind)
+ufshort Font::getUnicodeByIndex(ufshort ind)
{
return NULL;
}
//unicode = 0 - default glyph
-Glyph* Font::getGlyph(unsigned short unicode, unsigned short size) {
- unsigned long id;
+Glyph* Font::getGlyph(ufshort unicode, ufshort size) {
+ uflong id;
//printf("unicode = %lu, size = %lu\n", unicode,size);
if (!canDisplay(unicode)) {
- id = (unsigned long)(size << 16);
+ id = (uflong)(size << 16);
unicode = 0;
} else {
- id = (unsigned long)(size << 16) + unicode;
+ id = (uflong)(size << 16) + unicode;
}
//printf("unicode = %lu, size = %lu, id = %lu\n", unicode,size,id);
- std::map<const unsigned long, Glyph*>::iterator iter = _glyphMap.find(id);
+ std::map<const uflong, Glyph*>::iterator iter = _glyphMap.find(id);
if (iter != _glyphMap.end()) {
//printf("return the glyph");
return (Glyph *)(*iter).second;
@@ -116,10 +116,10 @@
}
// Creation of font depending on font type
-Font* createFont(char* family, StyleName sn) {
- int nLen = (int) strlen(family);
- wchar_t* name = new wchar_t[nLen+1];
- for (int i = 0; i <= nLen; i++)
+Font* createFont(fchar* family, StyleName sn) {
+ fint nLen = (fint) strlen(family);
+ fwchar_t* name = new fwchar_t[nLen+1];
+ for (fint i = 0; i <= nLen; i++)
name[i] = family[i];
Font* retFont = createFont(name, sn);
@@ -130,7 +130,7 @@
}
// Creation of font depending on font type
-Font* createFont(wchar_t* family, StyleName sn)
+Font* createFont(fwchar_t* family, StyleName sn)
{
Font* retFont;
bool isFound = false;
@@ -141,7 +141,7 @@
fh != NULL; fh=fh->_nextHeader)
{
- if (wcscmp(fh->_familyName,family)==0 && fh->_style == sn)
+ if (fwcscmp(fh->_familyName,family)==0 && fh->_style == sn)
{
switch(fh->_fType)
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Font.h Tue Jun 19 01:46:27 2007
@@ -23,6 +23,7 @@
#include <map>
#include "Glyph.h"
+#include "TypeDefinition.h"
typedef enum StyleNameTag {
Regular = 0,
@@ -33,23 +34,23 @@
typedef enum FlagsTag {ANGLE, IS_FIXED_PITCH, BOLD} Flags;
-static const unsigned char FONT_METRICS_QUANTITY = 8;
-static const unsigned char GLYPH_METRICS_QUANTITY = 6;
+static const ufchar FONT_METRICS_QUANTITY = 8;
+static const ufchar GLYPH_METRICS_QUANTITY = 6;
/*
typedef struct
{
- int numChars;
- int baselineIndex;
- float underlineThickness;
- float underlineOffset;
- float strikethroughThickness;
- float strikethroughOffset;
- float leading;
- float height;
- float descent;
- float ascent;
- float baseLineOffsets[1];
+ fint numChars;
+ fint baselineIndex;
+ ffloat underlineThickness;
+ ffloat underlineOffset;
+ ffloat strikethroughThickness;
+ ffloat strikethroughOffset;
+ ffloat leading;
+ ffloat height;
+ ffloat descent;
+ ffloat ascent;
+ ffloat baseLineOffsets[1];
}LineMetrics;
*/
@@ -58,43 +59,43 @@
Font();
virtual ~Font();
- Glyph* getGlyph(unsigned short unicode, unsigned short size);
+ Glyph* getGlyph(ufshort unicode, ufshort size);
Glyph* getDefaultGlyph();
- int getMissingGlyphCode();
+ fint getMissingGlyphCode();
- virtual Glyph* createGlyph(unsigned short unicode, unsigned short size);
- virtual float* getLineMetrics();
- virtual wchar_t* getPSName();
- virtual bool canDisplay(unsigned short c);
- virtual unsigned short getUnicodeByIndex(unsigned short ind);
+ virtual Glyph* createGlyph(ufshort unicode, ufshort size);
+ virtual ffloat* getLineMetrics();
+ virtual fwchar_t* getPSName();
+ virtual bool canDisplay(ufshort c);
+ virtual ufshort getUnicodeByIndex(ufshort ind);
//protected:
- unsigned short _numGlyphs; // Number of available glyphs
- wchar_t *_famName; // (unsigned short*) Family name
+ ufshort _numGlyphs; // Number of available glyphs
+ fwchar_t *_famName; // (ufshort*) Family name
StyleName _style; // Font style
- //short *_bitmaps; // - (?)
- float _boundingBox[4]; // Glyphs bounding box - array of 4 shorts
- float _ascent;
- float _descent;
- float _externalLeading; //lineGap in TrueType
- float _height;
- float _strikeOutSize;
- float _strikeOutOffset;
- float _underlineOffset;
- float _underlineThickness;
- unsigned short _size;
- std::map<const unsigned long, Glyph*> _glyphMap;//(size << 16 + unicode) -- Glyph
+ //fshort *_bitmaps; // - (?)
+ ffloat _boundingBox[4]; // Glyphs bounding box - array of 4 shorts
+ ffloat _ascent;
+ ffloat _descent;
+ ffloat _externalLeading; //lineGap in TrueType
+ ffloat _height;
+ ffloat _strikeOutSize;
+ ffloat _strikeOutOffset;
+ ffloat _underlineOffset;
+ ffloat _underlineThickness;
+ ufshort _size;
+ std::map<const uflong, Glyph*> _glyphMap;//(size << 16 + unicode) -- Glyph
Flags _flags;
-// virtual unsigned short* getBitmap();
-// virtual unsigned short* getOutline();
-// virtual unsigned short* getGlyph();
+// virtual ufshort* getBitmap();
+// virtual ufshort* getOutline();
+// virtual ufshort* getGlyph();
private:
- inline Glyph* findGlyph(unsigned short unicode, unsigned short size, unsigned long id);
+ inline Glyph* findGlyph(ufshort unicode, ufshort size, uflong id);
};
-Font* createFont(wchar_t* family, StyleName sn);
-Font* createFont(char* family, StyleName sn);
+Font* createFont(fwchar_t* family, StyleName sn);
+Font* createFont(fchar* family, StyleName sn);
#endif //__FONT_H__
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Glyph.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Glyph.cpp?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Glyph.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Glyph.cpp Tue Jun 19 01:46:27 2007
@@ -30,6 +30,6 @@
return NULL;
}
-float* Glyph::getGlyphMetrics(void){
+ffloat* Glyph::getGlyphMetrics(void){
return NULL;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Glyph.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Glyph.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Glyph.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Glyph.h Tue Jun 19 01:46:27 2007
@@ -22,19 +22,20 @@
#define __SHARED_GLYPH_CLASS_H
#include "Outline.h"
+#include "TypeDefinition.h"
class Glyph {
public:
Glyph();
virtual ~Glyph(void);
virtual Outline* getOutline(void);
- virtual float* getGlyphMetrics(void);
+ virtual ffloat* getGlyphMetrics(void);
//protected:
- unsigned short _size;
- unsigned short _unicode;
- float _advanceX;
- float _advanceY;
+ ufshort _size;
+ ufshort _unicode;
+ ffloat _advanceX;
+ ffloat _advanceY;
};
#endif //__SHARED_GLYPH_CLASS_H
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Outline.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Outline.cpp?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Outline.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Outline.cpp Tue Jun 19 01:46:27 2007
@@ -20,12 +20,12 @@
*/
#include "Outline.h"
-Outline::Outline(unsigned short pointsNumber, unsigned short commandNumber) {
+Outline::Outline(ufshort pointsNumber, ufshort commandNumber) {
pointsCount = 0;
commandsCount = 0;
- _points = new float[_pointsLength = pointsNumber];
- _commands = new unsigned char[_commandLenght = commandNumber];
+ _points = new ffloat[_pointsLength = pointsNumber];
+ _commands = new ufchar[_commandLenght = commandNumber];
/*for (commandsCount = 0 ; commandsCount < commandNumber; commandsCount ++) {
this->_commands[commandsCount] = SEG_CLOSE;
@@ -46,11 +46,11 @@
//printf("_length = %u, commandsCount = %u\n", _commandLenght, commandsCount);
- unsigned char *commandMas = new unsigned char[commandsCount];
- float *pointsMas = new float[pointsCount];
+ ufchar *commandMas = new ufchar[commandsCount];
+ ffloat *pointsMas = new ffloat[pointsCount];
memcpy(commandMas, _commands, commandsCount);
- memcpy(pointsMas, _points, pointsCount * sizeof(float));
+ memcpy(pointsMas, _points, pointsCount * sizeof(ffloat));
delete[] _points;
delete[] _commands;
@@ -62,21 +62,21 @@
_pointsLength = pointsCount;
}
-void Outline::lineTo(float x, float y) {
+void Outline::lineTo(ffloat x, ffloat y) {
_points[pointsCount ++] = x;
_points[pointsCount ++] = -y;
_commands[commandsCount ++] = SEG_LINETO;
//printf("SEG_LINETO ");
}
-void Outline::moveTo(float x, float y) {
+void Outline::moveTo(ffloat x, ffloat y) {
_commands[commandsCount ++] = SEG_MOVETO;
_points[pointsCount ++] = x;
_points[pointsCount ++] = -y;
// printf("SEG_MOVETO ");
}
-void Outline::quadTo(float x1, float y1, float x2, float y2) {
+void Outline::quadTo(ffloat x1, ffloat y1, ffloat x2, ffloat y2) {
_points[pointsCount ++] = x1;
_points[pointsCount ++] = -y1;
_points[pointsCount ++] = x2;
@@ -85,7 +85,7 @@
//printf("SEG_QUADTO ");
}
-void Outline::curveTo(float x1, float y1, float x2, float y2, float x3, float y3) {
+void Outline::curveTo(ffloat x1, ffloat y1, ffloat x2, ffloat y2, ffloat x3, ffloat y3) {
_points[pointsCount ++] = x1;
_points[pointsCount ++] = -y1;
_points[pointsCount ++] = x2;
@@ -106,10 +106,10 @@
//printf("SEG_CLOSE\n");
}
-unsigned short Outline::getPointsLength(void) {
+ufshort Outline::getPointsLength(void) {
return _pointsLength;
}
-unsigned short Outline::getCommandLength(void) {
+ufshort Outline::getCommandLength(void) {
return _commandLenght;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Outline.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Outline.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Outline.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/Outline.h Tue Jun 19 01:46:27 2007
@@ -22,6 +22,7 @@
#define __SHARED_OUTLINE_CLASS_H
#include <string>
+#include "TypeDefinition.h"
/*typedef enum {
SEG_CLOSE = 0,
@@ -39,43 +40,43 @@
SEG_CLOSE = 4
} SegmentType;*/
-static const unsigned char SEG_MOVETO = 0;
-static const unsigned char SEG_LINETO = 1;
-static const unsigned char SEG_QUADTO = 2;
-static const unsigned char SEG_CUBICTO = 3;
-static const unsigned char SEG_CLOSE = 4;
+static const ufchar SEG_MOVETO = 0;
+static const ufchar SEG_LINETO = 1;
+static const ufchar SEG_QUADTO = 2;
+static const ufchar SEG_CUBICTO = 3;
+static const ufchar SEG_CLOSE = 4;
class Outline {
public:
- Outline(unsigned short pointsNumber, unsigned short commandNumber);
+ Outline(ufshort pointsNumber, ufshort commandNumber);
~Outline();
- void lineTo(float x, float y);
+ void lineTo(ffloat x, ffloat y);
- void moveTo(float x, float y);
+ void moveTo(ffloat x, ffloat y);
- void quadTo(float x1, float y1, float x2, float y2);
+ void quadTo(ffloat x1, ffloat y1, ffloat x2, ffloat y2);
- void curveTo(float x1, float y1, float x2, float y2, float x3, float y3);
+ void curveTo(ffloat x1, ffloat y1, ffloat x2, ffloat y2, ffloat x3, ffloat y3);
void closePath(void);
- unsigned short getPointsLength(void);
- unsigned short getCommandLength(void);
+ ufshort getPointsLength(void);
+ ufshort getCommandLength(void);
void trim(void);
- float *_points;
- unsigned char *_commands;
+ ffloat *_points;
+ ufchar *_commands;
private:
- unsigned short _pointsLength;
- unsigned short _commandLenght;
+ ufshort _pointsLength;
+ ufshort _commandLenght;
- unsigned short pointsCount;
- unsigned short commandsCount;
+ ufshort pointsCount;
+ ufshort commandsCount;
};
#endif //__SHARED_OUTLINE_CLASS_H
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/ParsingTables.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/ParsingTables.cpp?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/ParsingTables.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/ParsingTables.cpp Tue Jun 19 01:46:27 2007
@@ -23,34 +23,34 @@
#include "Tables.h"
-static inline unsigned long dwReverse(unsigned long data)
+static inline uflong dwReverse(uflong data)
{
- unsigned char *dataElems = (unsigned char *) &data;
- return (unsigned long)((dataElems[0]<<24) | (dataElems[1]<<16) | (dataElems[2]<<8) | dataElems[3]);
+ ufchar *dataElems = (ufchar *) &data;
+ return (uflong)((dataElems[0]<<24) | (dataElems[1]<<16) | (dataElems[2]<<8) | dataElems[3]);
}
/* Reverses WORD bytes order */
-static inline unsigned short wReverse(unsigned short data)
+static inline ufshort wReverse(ufshort data)
{
- return (unsigned short)(((data<<8) & 0xFF00) | ((data>>8) & 0x00FF));
+ return (ufshort)(((data<<8) & 0xFF00) | ((data>>8) & 0x00FF));
}
/* Reverses WORD bytes order */
-static inline short wReverse(short data)
+static inline fshort wReverse(fshort data)
{
- return (short)(((data<<8) & 0xFF00) | ((data>>8) & 0x00FF));
+ return (fshort)(((data<<8) & 0xFF00) | ((data>>8) & 0x00FF));
}
/* Searching of table,
return TRUE if table founded */
-bool searchTable(unsigned long table, unsigned long* offset, FILE* tt_file)
+bool searchTable(uflong table, uflong* offset, FILE* tt_file)
{
Table_Offset tableOffset;
Table_Directory tableDirectory;
bool isFound = false;
- int size;
- int i;
+ fint size;
+ fint i;
/* Open font file stream */
// if( (tt_file = fopen( fPath,"rb")) == NULL ){
@@ -58,7 +58,7 @@
// return 0;
// }
- size = (int)fseek(tt_file,0,SEEK_SET);
+ size = (fint)fseek(tt_file,0,SEEK_SET);
if (size != 0)
{
#ifdef DEBUG
@@ -67,7 +67,7 @@
return 0;
}
- size = (int)fread(&tableOffset, sizeof(Table_Offset), 1, tt_file);
+ size = (fint)fread(&tableOffset, sizeof(Table_Offset), 1, tt_file);
if (size != 1){
#ifdef DEBUG
printf("Error reading font file\n");
@@ -88,14 +88,14 @@
/* look for 'head' table */
for(i=0; i< tableOffset.num_tables; i++)
{
- size = (int)fread(&tableDirectory, sizeof(Table_Directory), 1, tt_file);
+ size = (fint)fread(&tableDirectory, sizeof(Table_Directory), 1, tt_file);
if ( size != 1){
#ifdef DEBUG
printf("Error reading Table Directory from file.");
#endif
return 0;
}
- if (* (unsigned long*)tableDirectory.tag == table){
+ if (* (uflong*)tableDirectory.tag == table){
isFound = true;
// tableDirectory.length = dwReverse(tableDirectory.length);
// tableDirectory.offset = dwReverse(tableDirectory.offset);
@@ -106,17 +106,17 @@
return isFound;
}
-int getTableEncode_4(FILE* tt_file, TableEncode* te, unsigned short table_len)
+fint getTableEncode_4(FILE* tt_file, TableEncode* te, ufshort table_len)
{
- unsigned short* tableEncode;
- unsigned short length;
- int size, i;
+ ufshort* tableEncode;
+ ufshort length;
+ fint size, i;
- length = (table_len - sizeof(Table_encode_header))/sizeof(unsigned short); // in USHORTs
- tableEncode = new unsigned short[length];
+ length = (table_len - sizeof(Table_encode_header))/sizeof(ufshort); // in USHORTs
+ tableEncode = new ufshort[length];
/* reading tail of the table */
- size = (int)fread(tableEncode,sizeof(unsigned short),length,tt_file);
+ size = (fint)fread(tableEncode,sizeof(ufshort),length,tt_file);
if(size != length)
{
#ifdef DEBUG
@@ -136,26 +136,37 @@
return 0;
}
-#ifndef WIN32
-static inline bool compare(wchar_t* wstr, char* str)
+//#ifndef WIN32
+static inline bool compare(fwchar_t* wstr, fchar* str)
{
- char cstr[256];
- wcstombs(cstr,wstr,256);
- return !strcasecmp(cstr,str);
+// fchar cstr[256];
+// wcstombs(cstr,wstr,256);
+// return !strcasecmp(cstr,str);
+
+ fchar tmpstr[256];
+ fwchar_t* tmpwstr = wstr;
+ fint i = 0;
+ for (; i<= fwcslen(tmpwstr); i++)
+ {
+ tmpstr[i] = (fchar)((*wstr) & 0xFF);
+ }
+ tmpstr[i]=0;
+
+ return !strcmp(tmpstr,str);
}
-#endif
+//#endif
-int parseNameTable(FILE* tt_file, wchar_t** familyName, wchar_t** psName, StyleName* fontStyle)
+fint parseNameTable(FILE* tt_file, fwchar_t** familyName, fwchar_t** psName, StyleName* fontStyle)
{
- unsigned long dwTable = *(unsigned long*)NAME_TABLE;
- unsigned long offset;
+ uflong dwTable = *(uflong*)NAME_TABLE;
+ uflong offset;
Table_name tableName;
Name_Entry nameRecord;
- long curPos;
- unsigned short *subFamilyName;
+ flong curPos;
+ ufshort *subFamilyName;
- int i, j;
- int size;
+ fint i, j;
+ fint size;
bool inFamilyNameCase = false, inSubfamilyNameCase = false, inPSNameCase = false;
if (searchTable(dwTable, &offset, tt_file))
@@ -170,7 +181,7 @@
}
/* read 'name' table header */
- size = (int)fread(&tableName, sizeof(Table_name) - sizeof(Name_Entry), 1, tt_file);
+ size = (fint)fread(&tableName, sizeof(Table_name) - sizeof(Name_Entry), 1, tt_file);
if (size != 1){
#ifdef DEBUG
printf("Error reading Table 'Name' from file.");
@@ -184,7 +195,7 @@
/* enumerating NameRecords and finding Family Name value */
for(i=0; i < tableName.num_name_records; i++)
{
- size = (int)fread(&nameRecord, sizeof(Name_Entry), 1, tt_file);
+ size = (fint)fread(&nameRecord, sizeof(Name_Entry), 1, tt_file);
if (size != 1)
{
#ifdef DEBUG
@@ -217,13 +228,13 @@
}
-// ZeroMemory(&fontFamilyName, nameRecord.string_length/2 + sizeof(unsigned short));
+// ZeroMemory(&fontFamilyName, nameRecord.string_length/2 + sizeof(ufshort));
- unsigned short *fontFamilyName = new unsigned short[nameRecord.string_length/2+1];
+ ufshort *fontFamilyName = new ufshort[nameRecord.string_length/2+1];
// ZeroMemory(&(fontName[nameRecord.string_length]),1);
- size = (int)fread(fontFamilyName, sizeof(unsigned short), nameRecord.string_length/2, tt_file);
+ size = (fint)fread(fontFamilyName, sizeof(ufshort), nameRecord.string_length/2, tt_file);
if (size != nameRecord.string_length/2)
{
#ifdef DEBUG
@@ -237,24 +248,24 @@
for(j=0; j < nameRecord.string_length/2; j++)
{
(fontFamilyName)[j] = wReverse((fontFamilyName)[j]);
-//printf("%c",(char)(fontFamilyName)[j]);
+//printf("%c",(fchar)(fontFamilyName)[j]);
}
//printf("\n");
(fontFamilyName)[j] = 0;
inFamilyNameCase = true;
-#ifdef WIN32
- *familyName = (wchar_t*)fontFamilyName;
-#else
+//#ifdef WIN32
+ *familyName = (fwchar_t*)fontFamilyName;
+/*#else
//TODO: To unify this cycle and previous
- *familyName = new wchar_t[nameRecord.string_length/2+1];
+ *familyName = new fwchar_t[nameRecord.string_length/2+1];
for(j=0; j < nameRecord.string_length/2+1; j++)
{
- (*familyName)[j] = (wchar_t)fontFamilyName[j];
+ (*familyName)[j] = (fwchar_t)fontFamilyName[j];
}
delete fontFamilyName;
-#endif
+#endif*/
size = fseek( tt_file, curPos, SEEK_SET);
if (size != 0){
@@ -283,9 +294,9 @@
return -1;
}
- unsigned short *fontPSName = new unsigned short[nameRecord.string_length/2+1];
+ ufshort *fontPSName = new ufshort[nameRecord.string_length/2+1];
- size = (int)fread(fontPSName, sizeof(unsigned short), nameRecord.string_length/2, tt_file);
+ size = (fint)fread(fontPSName, sizeof(ufshort), nameRecord.string_length/2, tt_file);
if (size != nameRecord.string_length/2)
{
#ifdef DEBUG
@@ -303,18 +314,18 @@
(fontPSName)[j] = 0;
inPSNameCase = true;
-#ifdef WIN32
- *psName = (wchar_t*)fontPSName;
-#else
+//#ifdef WIN32
+ *psName = (fwchar_t*)fontPSName;
+/*#else
- *psName = new wchar_t[nameRecord.string_length/2+1];
+ *psName = new fwchar_t[nameRecord.string_length/2+1];
//TODO: To unify this cycle and previous
for(j=0; j < nameRecord.string_length/2+1; j++)
{
- (*psName)[j] = (wchar_t)fontPSName[j];
+ (*psName)[j] = (fwchar_t)fontPSName[j];
}
delete fontPSName;
-#endif
+#endif*/
size = fseek( tt_file, curPos, SEEK_SET);
if (size != 0){
@@ -343,13 +354,13 @@
return -1;
}
-// ZeroMemory(&fontName, nameRecord.string_length + sizeof(unsigned short));
+// ZeroMemory(&fontName, nameRecord.string_length + sizeof(ufshort));
- subFamilyName = new unsigned short[nameRecord.string_length/2+1];
+ subFamilyName = new ufshort[nameRecord.string_length/2+1];
// ZeroMemory(&(fontName[nameRecord.string_length]),1);
- size = (int)fread(subFamilyName, sizeof(unsigned short), nameRecord.string_length/2, tt_file);
+ size = (fint)fread(subFamilyName, sizeof(ufshort), nameRecord.string_length/2, tt_file);
if (size != nameRecord.string_length/2)
{
#ifdef DEBUG
@@ -366,21 +377,21 @@
}
subFamilyName[j] = 0;
-#ifdef WIN32
+/*#ifdef WIN32
-#define COMPARE_IT (!_wcsicmp((wchar_t *)subFamilyName,L"Italic"))
-#define COMPARE_BD (!_wcsicmp((wchar_t *)subFamilyName,L"Bold"))
-#define COMPARE_BDIT (!_wcsicmp((wchar_t *)subFamilyName,L"Bold Italic"))
-#define COMPARE_REG (!_wcsicmp((wchar_t *)subFamilyName,L"Regular") || !_wcsicmp((wchar_t *)subFamilyName,L"Normal"))
-
-#else
-
-#define COMPARE_IT (compare((wchar_t *)subFamilyName, "Italic"))
-#define COMPARE_BD (compare((wchar_t *)subFamilyName, "Bold"))
-#define COMPARE_BDIT (compare((wchar_t *)subFamilyName, "Bold Italic"))
-#define COMPARE_REG (compare((wchar_t *)subFamilyName, "Regular") || compare((wchar_t *)subFamilyName, "Normal"))
+#define COMPARE_IT (!_wcsicmp((fwchar_t *)subFamilyName,L"Italic"))
+#define COMPARE_BD (!_wcsicmp((fwchar_t *)subFamilyName,L"Bold"))
+#define COMPARE_BDIT (!_wcsicmp((fwchar_t *)subFamilyName,L"Bold Italic"))
+#define COMPARE_REG (!_wcsicmp((fwchar_t *)subFamilyName,L"Regular") || !_wcsicmp((fwchar_t *)subFamilyName,L"Normal"))
-#endif
+#else*/
+
+#define COMPARE_IT (compare((fwchar_t *)subFamilyName, "Italic"))
+#define COMPARE_BD (compare((fwchar_t *)subFamilyName, "Bold"))
+#define COMPARE_BDIT (compare((fwchar_t *)subFamilyName, "Bold Italic"))
+#define COMPARE_REG (compare((fwchar_t *)subFamilyName, "Regular") || compare((fwchar_t *)subFamilyName, "Normal"))
+
+//#endif
if COMPARE_IT
{
@@ -434,13 +445,13 @@
return 0;
}
-int parseHeadTable(FILE* tt_file, float* bbox, short* format, unsigned short* unitsPerEm)
+fint parseHeadTable(FILE* tt_file, ffloat* bbox, fshort* format, ufshort* unitsPerEm)
{
- unsigned long hTable = *(unsigned long*)HEAD_TABLE;
- unsigned long offset;
+ uflong hTable = *(uflong*)HEAD_TABLE;
+ uflong offset;
Table_head tableHead;
- int size;
+ fint size;
if (searchTable(hTable, &offset, tt_file))
{
@@ -454,7 +465,7 @@
}
/* read 'head' table header */
- size = (int)fread(&tableHead, sizeof(Table_head), 1, tt_file);
+ size = (fint)fread(&tableHead, sizeof(Table_head), 1, tt_file);
if (size != 1){
// printf("Error reading Table 'Head' from file.");
return -1;
@@ -485,8 +496,8 @@
// HDC hDC = GetDC(NULL);
// HDC hDC = GetDC(NULL);
// Table_head tableHead1;
-// unsigned long tbl = (unsigned long)"head";
-// int m = GetFontData(hDC,tbl,(unsigned long)offset,&tableHead1,sizeof(Table_head));
+// uflong tbl = (uflong)"head";
+// fint m = GetFontData(hDC,tbl,(uflong)offset,&tableHead1,sizeof(Table_head));
// ******* Validating data *********
// return *bbox;
@@ -494,13 +505,13 @@
return 0;
}
-int parseMaxpTable(FILE* tt_file, unsigned short* numGlyphs)
+fint parseMaxpTable(FILE* tt_file, ufshort* numGlyphs)
{
- unsigned long hTable = *(unsigned long*)MAXP_TABLE;
- unsigned long offset;
+ uflong hTable = *(uflong*)MAXP_TABLE;
+ uflong offset;
Table_maxp tableMaxp;
- int size;
+ fint size;
if (searchTable(hTable, &offset, tt_file))
{
@@ -512,7 +523,7 @@
}
/* read 'maxp' table header */
- size = (int)fread(&tableMaxp, sizeof(Table_maxp), 1, tt_file);
+ size = (fint)fread(&tableMaxp, sizeof(Table_maxp), 1, tt_file);
if (size != 1){
// printf("Error reading Table 'maxp' from file.");
return -1;
@@ -534,13 +545,13 @@
return 0;
}
-int parseHheaTable(FILE* tt_file, unsigned short* numOfHMetrics, float* ascent, float* descent, float* lineGap)
+fint parseHheaTable(FILE* tt_file, ufshort* numOfHMetrics, ffloat* ascent, ffloat* descent, ffloat* lineGap)
{
- unsigned long hTable = *(unsigned long*)HHEA_TABLE;
- unsigned long offset;
+ uflong hTable = *(uflong*)HHEA_TABLE;
+ uflong offset;
Table_hhea tableHhea;
- int size;
+ fint size;
if (searchTable(hTable, &offset, tt_file))
{
@@ -552,7 +563,7 @@
}
/* read 'hhea' table header */
- size = (int)fread(&tableHhea, sizeof(Table_hhea), 1, tt_file);
+ size = (fint)fread(&tableHhea, sizeof(Table_hhea), 1, tt_file);
if (size != 1){
// printf("Error reading Table 'hhea' from file.");
return -1;
@@ -570,13 +581,13 @@
return 0;
}
-int parseOs2Table(FILE* tt_file, float* strikeOutSize, float* strikeOutOffset)
+fint parseOs2Table(FILE* tt_file, ffloat* strikeOutSize, ffloat* strikeOutOffset)
{
- unsigned long hTable = *(unsigned long*)OS2_TABLE;
- unsigned long offset;
+ uflong hTable = *(uflong*)OS2_TABLE;
+ uflong offset;
Table_os2 tableOs2;
- int size;
+ fint size;
if (searchTable(hTable, &offset, tt_file))
{
@@ -588,7 +599,7 @@
}
/* read 'OS/2' table header */
- size = (int)fread(&tableOs2, sizeof(Table_os2), 1, tt_file);
+ size = (fint)fread(&tableOs2, sizeof(Table_os2), 1, tt_file);
if (size != 1){
// printf("Error reading Table 'OS/2' from file.");
return -1;
@@ -608,13 +619,13 @@
return 0;
}
-int parsePostTable(FILE* tt_file, short* uOffset, short* uThickness)
+fint parsePostTable(FILE* tt_file, fshort* uOffset, fshort* uThickness)
{
- unsigned long hTable = *(unsigned long*)POST_TABLE;
- unsigned long offset;
+ uflong hTable = *(uflong*)POST_TABLE;
+ uflong offset;
Table_post tablePost;
- int size;
+ fint size;
if (searchTable(hTable, &offset, tt_file))
{
@@ -626,7 +637,7 @@
}
/* read 'post' table header */
- size = (int)fread(&tablePost, sizeof(Table_post), 1, tt_file);
+ size = (fint)fread(&tablePost, sizeof(Table_post), 1, tt_file);
if (size != 1){
// printf("Error reading Table 'post' from file.");
return -1;
@@ -642,12 +653,12 @@
return 0;
}
-int parseHmtxTable(FILE* tt_file, unsigned short numOfHMetrics, HMetrics** hm)
+fint parseHmtxTable(FILE* tt_file, ufshort numOfHMetrics, HMetrics** hm)
{
- unsigned long hTable = *(unsigned long*)HMTX_TABLE;
- unsigned long offset;
+ uflong hTable = *(uflong*)HMTX_TABLE;
+ uflong offset;
- int size;
+ fint size;
if (searchTable(hTable, &offset, tt_file))
{
@@ -660,14 +671,14 @@
/* read 'hmtx' table */
*hm = new HMetrics[numOfHMetrics];
- size = (int)fread(*hm, sizeof(HMetrics), numOfHMetrics, tt_file);
+ size = (fint)fread(*hm, sizeof(HMetrics), numOfHMetrics, tt_file);
if (size != numOfHMetrics){
delete[] hm;
// printf("Error reading Table 'hmtx' from file.");
return -1;
}
- for (int i=0; i<numOfHMetrics;i++)
+ for (fint i=0; i<numOfHMetrics;i++)
{
(*hm)[i].adwance_width = wReverse((*hm)[i].adwance_width);
}
@@ -680,19 +691,19 @@
return 0;
}
-int parseLocaTable(FILE* tt_file, GlyphOffsets* gOffsets, unsigned short numGlyphs)
+fint parseLocaTable(FILE* tt_file, GlyphOffsets* gOffsets, ufshort numGlyphs)
{
- unsigned long hTable = *(unsigned long*)LOCA_TABLE;
- unsigned long gTable = *(unsigned long*)GLYF_TABLE;
- unsigned long offset,localGlyfOffset;
-
- unsigned long *gLongOffsets = NULL;
- unsigned short *gShortOffsets = NULL;
- int size, i;
+ uflong hTable = *(uflong*)LOCA_TABLE;
+ uflong gTable = *(uflong*)GLYF_TABLE;
+ uflong offset,localGlyfOffset;
+
+ uflong *gLongOffsets = NULL;
+ ufshort *gShortOffsets = NULL;
+ fint size, i;
- gLongOffsets = new unsigned long[numGlyphs+1];
+ gLongOffsets = new uflong[numGlyphs+1];
if (!(*gOffsets).format)
- gShortOffsets = new unsigned short[numGlyphs+1];
+ gShortOffsets = new ufshort[numGlyphs+1];
if (searchTable(hTable, &offset, tt_file) && searchTable(gTable,&localGlyfOffset,tt_file))
{
@@ -715,7 +726,7 @@
/* read 'loca' table */
if (gOffsets->format)
{
- size = (int)fread(gLongOffsets, sizeof(long),numGlyphs+1, tt_file);
+ size = (fint)fread(gLongOffsets, sizeof(flong),numGlyphs+1, tt_file);
if (size != numGlyphs+1)
{
// printf("Error reading Table 'loca' from file.");
@@ -727,7 +738,7 @@
gLongOffsets[i] = dwReverse(gLongOffsets[i])+localGlyfOffset;
}else
{
- size = (int)fread(gShortOffsets, sizeof(short), numGlyphs+1, tt_file);
+ size = (fint)fread(gShortOffsets, sizeof(fshort), numGlyphs+1, tt_file);
if (size != numGlyphs+1)
{
// printf("Error reading Table 'loca' from file.");
@@ -749,17 +760,17 @@
return 0;
};
-int parseCmapTable(FILE* tt_file, TableEncode* te)
+fint parseCmapTable(FILE* tt_file, TableEncode* te)
{
- unsigned long hTable = *(unsigned long*)CMAP_TABLE;
- unsigned long offset;
+ uflong hTable = *(uflong*)CMAP_TABLE;
+ uflong offset;
Table_cmap tableCmap;
Cmap_Entry cmapRecord;
Table_encode_header tableEncodeHeader;
- long curPos;
+ flong curPos;
- int i;
- int size;
+ fint i;
+ fint size;
if (searchTable(hTable, &offset, tt_file))
{
@@ -771,7 +782,7 @@
}
/* read 'cmap' table header */
- size = (int)fread(&tableCmap, sizeof(Table_cmap) - sizeof(Cmap_Entry), 1, tt_file);
+ size = (fint)fread(&tableCmap, sizeof(Table_cmap) - sizeof(Cmap_Entry), 1, tt_file);
if (size != 1){
// printf("Error reading Table 'cmap' from file.");
return -1;
@@ -781,7 +792,7 @@
for(i=0; i < tableCmap.numSubTables; i++)
{
- size = (int)fread(&cmapRecord, sizeof(Cmap_Entry), 1, tt_file);
+ size = (fint)fread(&cmapRecord, sizeof(Cmap_Entry), 1, tt_file);
if (size != 1)
{
// printf("Error reading cmap Record from file.");
@@ -807,7 +818,7 @@
}
- size = (int)fread(&tableEncodeHeader, sizeof(Table_encode_header), 1, tt_file);
+ size = (fint)fread(&tableEncodeHeader, sizeof(Table_encode_header), 1, tt_file);
if (size != 1)
{
// printf("Error reading Table Encode from file.");
@@ -820,9 +831,9 @@
if (tableEncodeHeader.format == 0 && te->TableEncode == NULL)
{
- unsigned char *map = new unsigned char[256];
+ ufchar *map = new ufchar[256];
te->format = 0;
- size = (int)fread(map, sizeof(unsigned char), 256, tt_file);
+ size = (fint)fread(map, sizeof(ufchar), 256, tt_file);
if (size != 256)
{
// printf("Error reading map format 0");
@@ -854,29 +865,29 @@
return 0;
}
-int parseGlyphData(FILE* tt_file, const GlyphOffsets gO, unsigned short numGlyphs, unsigned short glyphIndex, TTCurve *curve, short* bRect, float transform)
+fint parseGlyphData(FILE* tt_file, const GlyphOffsets gO, ufshort numGlyphs, ufshort glyphIndex, TTCurve *curve, fshort* bRect, ffloat transform)
{
- unsigned long offset;
+ uflong offset;
Glyph_header glyphHeader;
- short numOfContours;
- unsigned short *endPtsOfContours = NULL;
- unsigned short instructionLength;//instruction length in bytes
- unsigned char* instructions = NULL;
- unsigned char* flags = NULL;
- unsigned char* xCoord = NULL; //pointer to array of X coordinates
- unsigned char* yCoord = NULL; //pointer to array of Y coordinates
- unsigned char* tmp = NULL;
-
- int numPoints; // number of Points
- int size, i, j, curLen;
- int flagIndex = 0;
- int xCoordIndex = 0;
- int yCoordIndex = 0;
- int rep = 0;
-
- short xLength = 0; //length of array of X coordinates
- short yLength = 0; //length of array of Y coordinates
- unsigned char curFlag = 0;
+ fshort numOfContours;
+ ufshort *endPtsOfContours = NULL;
+ ufshort instructionLength;//instruction length in bytes
+ ufchar* instructions = NULL;
+ ufchar* flags = NULL;
+ ufchar* xCoord = NULL; //pointer to array of X coordinates
+ ufchar* yCoord = NULL; //pointer to array of Y coordinates
+ ufchar* tmp = NULL;
+
+ fint numPoints; // number of Points
+ fint size, i, j, curLen;
+ fint flagIndex = 0;
+ fint xCoordIndex = 0;
+ fint yCoordIndex = 0;
+ fint rep = 0;
+
+ fshort xLength = 0; //length of array of X coordinates
+ fshort yLength = 0; //length of array of Y coordinates
+ ufchar curFlag = 0;
if (glyphIndex >= numGlyphs)
{
@@ -898,7 +909,7 @@
}
/* read 'Glyph_header' table */
- size = (int)fread(&glyphHeader, sizeof(Glyph_header), 1, tt_file);
+ size = (fint)fread(&glyphHeader, sizeof(Glyph_header), 1, tt_file);
if (size != 1){
// printf("Error reading 'Glyph_header' table from file.");
return -1;
@@ -913,8 +924,8 @@
if (numOfContours > 0)
{
- endPtsOfContours = new unsigned short[numOfContours];
- size = (int)fread(endPtsOfContours, sizeof(short),numOfContours,tt_file);
+ endPtsOfContours = new ufshort[numOfContours];
+ size = (fint)fread(endPtsOfContours, sizeof(fshort),numOfContours,tt_file);
if (size != numOfContours)
{
// printf("Error reading endPtsOfContours for someone glyph.");
@@ -928,7 +939,7 @@
}
numPoints = endPtsOfContours[i-1] + 1;
- size = (int)fread(&instructionLength,sizeof(short),1,tt_file);
+ size = (fint)fread(&instructionLength,sizeof(fshort),1,tt_file);
if (size != 1)
{
// printf("Error reading length of instructions./n");
@@ -937,8 +948,8 @@
}
instructionLength = wReverse(instructionLength);
- instructions = new unsigned char[instructionLength];
- size = (int)fread(instructions,sizeof(unsigned char),instructionLength,tt_file);
+ instructions = new ufchar[instructionLength];
+ size = (fint)fread(instructions,sizeof(ufchar),instructionLength,tt_file);
if (size != instructionLength)
{
// printf("Error reading instructions./n");
@@ -952,15 +963,15 @@
for (i=0; i<numPoints; i++)
{
- int x_repeat = 0;
- int y_repeat = 0;
+ fint x_repeat = 0;
+ fint y_repeat = 0;
tmp = flags;
curLen++;
- flags = new unsigned char[curLen];
+ flags = new ufchar[curLen];
memcpy(flags,tmp,curLen-1);
delete[] tmp;
- size = (int)fread(&(flags[curLen-1]),sizeof(unsigned char),1,tt_file);
+ size = (fint)fread(&(flags[curLen-1]),sizeof(ufchar),1,tt_file);
if (size != 1)
{
// printf("Error reading array of flags from font file.\n");
@@ -986,10 +997,10 @@
{
tmp = flags;
curLen++;
- flags = new unsigned char[curLen];
+ flags = new ufchar[curLen];
memcpy(flags,tmp,curLen-1);
delete[] tmp;
- size=(int)fread(&(flags[curLen-1]),sizeof(unsigned char),1,tt_file);
+ size=(fint)fread(&(flags[curLen-1]),sizeof(ufchar),1,tt_file);
if (size != 1)
{
// printf("Error reading array of flags from font file.\n");
@@ -1009,10 +1020,10 @@
yLength += y_repeat;
}
- xCoord = new unsigned char[xLength];
- yCoord = new unsigned char[yLength];
+ xCoord = new ufchar[xLength];
+ yCoord = new ufchar[yLength];
- size = (int)fread(xCoord,sizeof(unsigned char),xLength,tt_file);
+ size = (fint)fread(xCoord,sizeof(ufchar),xLength,tt_file);
if (size != xLength)
{
// printf("Error reading x-coordinate of glyph's point.\n");
@@ -1022,7 +1033,7 @@
return -1;
}
- size = (int)fread(yCoord,sizeof(unsigned char),yLength,tt_file);
+ size = (fint)fread(yCoord,sizeof(ufchar),yLength,tt_file);
if (size != yLength)
{
// printf("Error reading coordinates of glyph points.\n");
@@ -1034,13 +1045,13 @@
i=0;
rep=0;
- int x=0, y=0;
- float xFirstInContour,yFirstInContour;
+ fint x=0, y=0;
+ ffloat xFirstInContour,yFirstInContour;
bool contBegin; //íà÷àëî êîíòóðà
for (j=0; j<numOfContours;j++)
{
- int repLim = endPtsOfContours[j];
+ fint repLim = endPtsOfContours[j];
contBegin = 1;
while(i<=repLim)
@@ -1058,7 +1069,7 @@
}
}
- int xChange = 0, yChange = 0;
+ fint xChange = 0, yChange = 0;
if ((curFlag & X_POSITIVE) == X_POSITIVE)
{
@@ -1070,7 +1081,7 @@
xCoordIndex++;
}else if ((curFlag & X_POSITIVE) == X_DWORD)
{
- xChange = (short)((xCoord[xCoordIndex]<<8)+xCoord[xCoordIndex+1]);
+ xChange = (fshort)((xCoord[xCoordIndex]<<8)+xCoord[xCoordIndex+1]);
xCoordIndex+=2;
}
@@ -1084,7 +1095,7 @@
yCoordIndex++;
}else if ((curFlag & Y_POSITIVE) == Y_DWORD)
{
- yChange = (short)((yCoord[yCoordIndex]<<8)+yCoord[yCoordIndex+1]);
+ yChange = (fshort)((yCoord[yCoordIndex]<<8)+yCoord[yCoordIndex+1]);
yCoordIndex+=2;
}
@@ -1124,12 +1135,12 @@
}
/* Should be removed when the composite glyph parsing will be realized */
-bool isCompositeGlyph(FILE* tt_file, const GlyphOffsets gO, unsigned short numGlyphs, unsigned short glyphIndex)
+bool isCompositeGlyph(FILE* tt_file, const GlyphOffsets gO, ufshort numGlyphs, ufshort glyphIndex)
{
- unsigned long offset;
+ uflong offset;
Glyph_header glyphHeader;
- int size;
+ fint size;
if (glyphIndex >= numGlyphs)
glyphIndex = 0;
@@ -1151,7 +1162,7 @@
}
//printf("second return\n");
/* read 'Glyph_header' table */
- size = (int)fread(&glyphHeader, sizeof(Glyph_header), 1, tt_file);
+ size = (fint)fread(&glyphHeader, sizeof(Glyph_header), 1, tt_file);
if (size != 1)
return false;
//printf("third return\n");
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Font.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Font.cpp?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Font.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Font.cpp Tue Jun 19 01:46:27 2007
@@ -24,7 +24,7 @@
#include "T1Font.h"
#include "T1Glyph.h"
-T1Font::T1Font(wchar_t *family, StyleName sn, char* pathToFile):Font() {
+T1Font::T1Font(fwchar_t *family, StyleName sn, fchar* pathToFile):Font() {
//this->_famName = family;
_style = sn;
@@ -36,7 +36,7 @@
try {
initFont(inputFile);
- } catch (char*) {
+ } catch (fchar*) {
//printf("%s", str);
}
@@ -47,7 +47,7 @@
_descent = 195;
- char path[MAX_STR_LENGHT];
+ fchar path[MAX_STR_LENGHT];
size_t length = strlen(pathToFile) - 3;
strncpy(path, pathToFile, length);
@@ -85,42 +85,42 @@
delete fullName;
}
-Glyph* T1Font::createGlyph(unsigned short unicode, unsigned short size) {
+Glyph* T1Font::createGlyph(ufshort unicode, ufshort size) {
- /*float floatMas[4];
+ /*ffloat floatMas[4];
Type1AFMMap::iterator iter = afmMap.find(unicode);
- //return iter == glyphCodeMap.end()? NULL : (unsigned short)iter->second;
+ //return iter == glyphCodeMap.end()? NULL : (ufshort)iter->second;
- memcpy(floatMas, _boundingBox, 4 * sizeof(float));
+ memcpy(floatMas, _boundingBox, 4 * sizeof(ffloat));
if (iter != afmMap.end()) {
//printf("%s\n", iter->second);
- char* curValue = strstr( iter->second, " B ");
+ fchar* curValue = strstr( iter->second, " B ");
if (curValue != NULL) {
curValue += 3;
- floatMas[0] = (float) atof(curValue);
+ floatMas[0] = (ffloat) atof(curValue);
//printf("0 = %f\n", floatMas[0]);
while (*(++curValue) != ' ') {
}
- floatMas[1] = (float) atof(curValue);
+ floatMas[1] = (ffloat) atof(curValue);
//printf("1 = %f\n", floatMas[1]);
while (*(++curValue) != ' ') {
}
- floatMas[2] = (float) atof(curValue);
+ floatMas[2] = (ffloat) atof(curValue);
//printf("2 = %f\n", floatMas[2]);
while (*(++curValue) != ' ') {
}
- floatMas[3] = (float) atof(curValue);
+ floatMas[3] = (ffloat) atof(curValue);
//printf("3 = %f\n", floatMas[3]);
}
}*/
@@ -131,11 +131,11 @@
}
//TODO: owerwrite this:
-wchar_t* T1Font::getPSName() {
+fwchar_t* T1Font::getPSName() {
return fullName;
}
-float* T1Font::getLineMetrics() {
+ffloat* T1Font::getLineMetrics() {
/*
* metrics[0] - ascent<p>
* metrics[1] - descent<p>
@@ -144,9 +144,9 @@
* metrics[4] - underline offset<p>
* metrics[5] - strikethrough thickness<p>
* metrics[6] - strikethrough offset<p>
- * metrics[7] - maximum char width<p>*/
+ * metrics[7] - maximum fchar width<p>*/
- float* floatMas = new float[FONT_METRICS_QUANTITY];
+ ffloat* floatMas = new ffloat[FONT_METRICS_QUANTITY];
floatMas[0] = _ascent / matrixScale; //ascent
floatMas[1] = _descent / matrixScale; //descent
@@ -158,19 +158,19 @@
floatMas[5] = _underlineThickness / matrixScale;//_strikeOutSize;
floatMas[6] = -_ascent/(2 * matrixScale);//_strikeOutOffset;
- floatMas[7] = ((float)(_boundingBox[3] - _boundingBox[1])) / matrixScale;
+ floatMas[7] = ((ffloat)(_boundingBox[3] - _boundingBox[1])) / matrixScale;
return floatMas;
}
-bool T1Font::canDisplay(unsigned short ch) {
+bool T1Font::canDisplay(ufshort ch) {
return this->charStringMap.find(ch) != this->charStringMap.end();
}
-unsigned short T1Font::getUnicodeByIndex(unsigned short index) {
+ufshort T1Font::getUnicodeByIndex(ufshort index) {
Type1GlyphCodeMap::iterator iter = glyphCodeMap.find(index);
- return iter == glyphCodeMap.end()? 0 : (unsigned short)iter->second;
+ return iter == glyphCodeMap.end()? 0 : (ufshort)iter->second;
}
void error(){
@@ -178,16 +178,16 @@
throw "invalidfont";
}
-unsigned inline short hexCharToUShort(char ch){
+inline ufshort hexCharToUShort(fchar ch){
return ch >= '0' && ch <= '9' ? ch - '0' :
ch >= 'A' && ch <= 'F' ? ch - 'A' + 10 :
ch >= 'a' && ch <= 'f' ? ch - 'a' + 10 :
0;
}
-void static getNextLine(char* str, FILE* font) {
- unsigned short count = 0;
- unsigned char ch = ' ';
+void static getNextLine(fchar* str, FILE* font) {
+ ufshort count = 0;
+ ufchar ch = ' ';
while (!feof(font) && (ch == ' ' || ch == '\n' || ch == '\r')) {
ch = getc(font);
@@ -201,8 +201,8 @@
str[count] = '\0';
}
-unsigned static char getNextChar(FILE* font) {
- unsigned char ch;
+static ufchar getNextChar(FILE* font) {
+ ufchar ch;
do {
ch = getc(font);
} while (ch == '\r' || ch == '\n');
@@ -210,30 +210,30 @@
return ch;
}
-unsigned static char decryptNextSimbol(FILE* font, unsigned short* r, bool isASCII) {
- unsigned char clipher = (unsigned char)(
+static ufchar decryptNextSimbol(FILE* font, ufshort* r, bool isASCII) {
+ ufchar clipher = (ufchar)(
isASCII ?
- (unsigned char) ((hexCharToUShort(getNextChar(font)) << 4 ) + (hexCharToUShort(getNextChar(font)))) :
+ (ufchar) ((hexCharToUShort(getNextChar(font)) << 4 ) + (hexCharToUShort(getNextChar(font)))) :
getc(font)
);
- unsigned char plain = (unsigned char)(clipher ^ (*r >> 8));
- *r = ( (unsigned char)clipher + *r ) * C1 + C2;
+ ufchar plain = (ufchar)(clipher ^ (*r >> 8));
+ *r = ( (ufchar)clipher + *r ) * C1 + C2;
return plain;
}
-void static decodeASCIILine(char* str, unsigned short* r, unsigned short n, unsigned short length) {
- char* p = str;
- unsigned char plain;
- unsigned char clipher;
- unsigned short count = 0;
+void static decodeASCIILine(fchar* str, ufshort* r, ufshort n, ufshort length) {
+ fchar* p = str;
+ ufchar plain;
+ ufchar clipher;
+ ufshort count = 0;
length /= 2;
while(count < length) {
- clipher = (unsigned char)((hexCharToUShort(*p) << 4 ) + (hexCharToUShort(*(p + 1))));
+ clipher = (ufchar)((hexCharToUShort(*p) << 4 ) + (hexCharToUShort(*(p + 1))));
- plain = (unsigned char)(clipher ^ (*r >> 8));
- *r = ( (unsigned char)clipher + *r ) * C1 + C2;
+ plain = (ufchar)(clipher ^ (*r >> 8));
+ *r = ( (ufchar)clipher + *r ) * C1 + C2;
if (count >= n) {
str[count - n] = plain;
@@ -246,16 +246,16 @@
str[count - n] = '\0';
}
-void static decodeBinaryLine(char* str, unsigned short* r, unsigned short n, unsigned short length) {
- char* p = str;
- unsigned char plain;
- unsigned char clipher;
- unsigned short count = 0;
+void static decodeBinaryLine(fchar* str, ufshort* r, ufshort n, ufshort length) {
+ fchar* p = str;
+ ufchar plain;
+ ufchar clipher;
+ ufshort count = 0;
while(count < length) {
- clipher = (unsigned char)*p;
+ clipher = (ufchar)*p;
- plain = (unsigned char)(clipher ^ (*r >> 8));
- *r = ( (unsigned char)clipher + *r ) * C1 + C2;
+ plain = (ufchar)(clipher ^ (*r >> 8));
+ *r = ( (ufchar)clipher + *r ) * C1 + C2;
if (count >= n) {
str[count - n] = plain;
@@ -268,7 +268,7 @@
str[count - n] = '\0';
}
-void static decodeLine(char* str, unsigned short* r, unsigned short n, bool isASCII, unsigned short length) {
+void static decodeLine(fchar* str, ufshort* r, ufshort n, bool isASCII, ufshort length) {
if (isASCII) {
decodeASCIILine(str,r,n,length);
@@ -276,18 +276,18 @@
decodeBinaryLine(str,r,n,length);
}
return;
- /*char* p = str;
- unsigned char plain;
- unsigned char clipher;
- unsigned short count = 0;
+ /*fchar* p = str;
+ ufchar plain;
+ ufchar clipher;
+ ufshort count = 0;
if (isASCII) {
length /= 2;
}
while(count < length) {
- clipher = (unsigned char)(isASCII ? ((hexCharToUShort(*p) << 4 ) + (hexCharToUShort(*(p + 1)))) : *p);
+ clipher = (ufchar)(isASCII ? ((hexCharToUShort(*p) << 4 ) + (hexCharToUShort(*(p + 1)))) : *p);
- plain = (unsigned char)(clipher ^ (*r >> 8));
- *r = ( (unsigned char)clipher + *r ) * C1 + C2;
+ plain = (ufchar)(clipher ^ (*r >> 8));
+ *r = ( (ufchar)clipher + *r ) * C1 + C2;
//printf("%u ---- %u,%u\n", clipher, plain, *r);
if (count >= n) {
@@ -301,9 +301,9 @@
str[count - n] = '\0';//*/
}
-void static getNextDecodeLine(char* str, FILE* font, unsigned short* r, bool isASCII) {
- unsigned short count = 0;
- unsigned char plain;
+void static getNextDecodeLine(fchar* str, FILE* font, ufshort* r, bool isASCII) {
+ ufshort count = 0;
+ ufchar plain;
while(!feof(font)) {
plain = decryptNextSimbol(font, r, isASCII);
@@ -317,9 +317,9 @@
str[count] = '\0';
}
-void static getNextDecodeLexeme(char* str, FILE* font, unsigned short* r, bool isASCII) {
- unsigned char ch;
- unsigned short count = 0;
+void static getNextDecodeLexeme(fchar* str, FILE* font, ufshort* r, bool isASCII) {
+ ufchar ch;
+ ufshort count = 0;
while (!feof(font) && ((ch = decryptNextSimbol(font, r, isASCII)) == ' ' || ch == '\n' || ch == '\r')) {
}
@@ -332,9 +332,9 @@
str[count] = '\0';
}
-void static getNextLexeme(char* str, FILE* font) {
- unsigned char ch;
- unsigned short count = 0;
+void static getNextLexeme(fchar* str, FILE* font) {
+ ufchar ch;
+ ufshort count = 0;
while (!feof(font) && ((ch = getc(font)) == ' ' || ch == '\n' || ch == '\r' && ch != '{')) {
}
@@ -347,11 +347,11 @@
str[count] = '\0';
}
-unsigned short static findUnicode(const char *str) {
+ufshort static findUnicode(const fchar *str) {
- unsigned short count = 0;
- unsigned short strCount = 0;
- unsigned short lastStrCount = 0;
+ ufshort count = 0;
+ ufshort strCount = 0;
+ ufshort lastStrCount = 0;
while(true) {
if (GLYPH_LIST[count] == str[strCount]) {
@@ -361,7 +361,7 @@
} else if ((GLYPH_LIST[count] ^ (1 << 7)) == str[strCount]) {
strCount ++;
if (str[strCount] == '\0') {
- return (unsigned short)((GLYPH_LIST[count + 1] << 8) + GLYPH_LIST[count + 2]);
+ return (ufshort)((GLYPH_LIST[count + 1] << 8) + GLYPH_LIST[count + 2]);
}
count = ((GLYPH_LIST[count + 5] << 8) + GLYPH_LIST[count + 6]);
@@ -391,7 +391,7 @@
}
}
-unsigned short static getUnicode(char *name) {
+ufshort static getUnicode(fchar *name) {
if (!strncmp(name, ".notdef", 7)) {
return 0;
}
@@ -400,7 +400,7 @@
}
void T1Font::parseAFM(FILE *font) {
- char curStr[MAX_STR_LENGHT];
+ fchar curStr[MAX_STR_LENGHT];
while (!feof(font)) {
getNextLexeme(curStr, font);
@@ -411,20 +411,20 @@
return;
} else if (!strcmp(curStr, "Ascender")) {
getNextLexeme(curStr, font);
- _ascent = (float) fabs(atof(curStr));
+ _ascent = (ffloat) fabs(atof(curStr));
//printf("ascend = %f\n", _ascent);
} else if (!strcmp(curStr, "Descender")) {
getNextLexeme(curStr, font);
- _descent = (float) fabs(atof(curStr));
+ _descent = (ffloat) fabs(atof(curStr));
//printf("descent = %f\n", _descent);
} /*else if (!strcmp(curStr, "StartCharMetrics")) {
getNextLexeme(curStr, font);
- char* curValue;
- char psName[MAX_STR_LENGHT];
- unsigned short count = (unsigned short) atoi(curStr);
- for (unsigned short i = 0; i < count; i ++) {
+ fchar* curValue;
+ fchar psName[MAX_STR_LENGHT];
+ ufshort count = (ufshort) atoi(curStr);
+ for (ufshort i = 0; i < count; i ++) {
getNextLine(curStr, font);
//printf("%s\n",curStr);
@@ -435,13 +435,13 @@
//printf("%s\n", curValue);
- unsigned short i;
+ ufshort i;
for (i = 0; curValue[i] != ' ' && curValue[i] != '\0'; i ++) {
psName[i] = curValue[i];
}
psName[i] = '\0';
- curValue = new char[strlen(curStr) + 1];
+ curValue = new fchar[strlen(curStr) + 1];
strcpy(curValue, curStr);
@@ -459,26 +459,26 @@
void T1Font::initFont(FILE *font) {
- char curStr[MAX_STR_LENGHT];
+ fchar curStr[MAX_STR_LENGHT];
DecodeState state = HEADER;
- unsigned short r = DEF_R_EXEC;
- unsigned short n = 4;
+ ufshort r = DEF_R_EXEC;
+ ufshort n = 4;
- unsigned short lenIV = DEF_LENIV;
- unsigned short charStringR;
+ ufshort lenIV = DEF_LENIV;
+ ufshort charStringR;
- unsigned short count = 0;
- unsigned short tempShort = 0;
- unsigned short length = 0;
- unsigned short valueLength = 0;
+ ufshort count = 0;
+ ufshort tempShort = 0;
+ ufshort length = 0;
+ ufshort valueLength = 0;
matrixScale = 1000;
bool isASCII = true;
- unsigned char ch;
+ ufchar ch;
EncodedValue *curValue;
ch = getc(font);
@@ -498,10 +498,10 @@
if (!strcmp(curStr, "/UnderlinePosition")) {
getNextLexeme(curStr, font);
- _underlineOffset = (float) - atof(curStr);
+ _underlineOffset = (ffloat) - atof(curStr);
} else if (!strcmp(curStr, "/UnderlineThickness")) {
getNextLexeme(curStr, font);
- _underlineThickness = (float) atof(curStr);
+ _underlineThickness = (ffloat) atof(curStr);
} else if (strstr(curStr, "/FontBBox") != NULL) {
//getNextLexeme(curStr, font);
@@ -511,18 +511,18 @@
ungetc(ch, font);
getNextLexeme(curStr, font);
- _boundingBox[0] = (float) atof(curStr);
+ _boundingBox[0] = (ffloat) atof(curStr);
getNextLexeme(curStr, font);
- _boundingBox[1] = (float) atof(curStr);
+ _boundingBox[1] = (ffloat) atof(curStr);
getNextLexeme(curStr, font);
- _boundingBox[2] = (float) atof(curStr);
+ _boundingBox[2] = (ffloat) atof(curStr);
getNextLexeme(curStr, font);
- _boundingBox[3] = (float) atof(curStr);
+ _boundingBox[3] = (ffloat) atof(curStr);
- _height = ((float)(_boundingBox[2] -_boundingBox[0]));
+ _height = ((ffloat)(_boundingBox[2] -_boundingBox[0]));
} else if (!strcmp(curStr, "/FullName")) {
//getNextLexeme(curStr, font);
@@ -537,10 +537,10 @@
curStr[count] = '\0';
- char *ptr = curStr;
+ fchar *ptr = curStr;
ch = 0;
- fullName = new wchar_t[count + 1];
+ fullName = new fwchar_t[count + 1];
while (*ptr != '\0') {
fullName[ch ++] = *ptr;
ptr ++;
@@ -563,7 +563,7 @@
curStr[count] = getc(font);
}
- if (curStr[0] != (char)0x80 || curStr[1] != 0x02) {
+ if (curStr[0] != (fchar)0x80 || curStr[1] != 0x02) {
error();
}
for (count = 0; count < lenIV; count ++) {
@@ -601,10 +601,10 @@
getNextDecodeLexeme(curStr, font, &r, isASCII);
getNextDecodeLexeme(curStr, font, &r, isASCII);
- curValue->number = (unsigned short) atoi(curStr);
+ curValue->number = (ufshort) atoi(curStr);
getNextDecodeLexeme(curStr, font, &r, isASCII);
- length = (unsigned short) atoi(curStr);
+ length = (ufshort) atoi(curStr);
curValue->length = length - lenIV;
getNextDecodeLexeme(curStr, font, &r, isASCII);
@@ -616,7 +616,7 @@
charStringR = DEF_R_CHARSTRING;
decodeBinaryLine(curStr, &charStringR, lenIV, length);
- curValue->text = new char[curValue->length];
+ curValue->text = new fchar[curValue->length];
for (tempShort = 0; tempShort - curValue->length < 0; tempShort ++) {
curValue->text[tempShort] = curStr[tempShort];
}
@@ -645,7 +645,7 @@
curValue->number = tempShort;
getNextDecodeLexeme(curStr, font, &r, isASCII);
- length = (unsigned short) atoi(curStr);
+ length = (ufshort) atoi(curStr);
curValue->length = length - lenIV;
getNextDecodeLexeme(curStr, font, &r, isASCII);
@@ -656,14 +656,14 @@
charStringR = DEF_R_CHARSTRING;
decodeBinaryLine(curStr, &charStringR, lenIV, length);
- curValue->text = new char[curValue->length];
+ curValue->text = new fchar[curValue->length];
for (tempShort = 0; tempShort - curValue->length < 0; tempShort ++) {
curValue->text[tempShort] = curStr[tempShort];
}
charStringMap[curValue->number] = curValue;
} else {
getNextDecodeLexeme(curStr, font, &r, isASCII);
- length = (unsigned short) atoi(curStr);
+ length = (ufshort) atoi(curStr);
getNextDecodeLexeme(curStr, font, &r, isASCII);
for (tempShort = 0; tempShort - length < 0; tempShort ++) {
Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Font.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Font.h?view=diff&rev=548654&r1=548653&r2=548654
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Font.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/native/fontlib/shared/T1Font.h Tue Jun 19 01:46:27 2007
@@ -29,16 +29,16 @@
class T1Font : public Font {
public:
- T1Font(wchar_t *family, StyleName sn, char* pathToFile);
+ T1Font(fwchar_t *family, StyleName sn, fchar* pathToFile);
~T1Font(void);
- Glyph* createGlyph(unsigned short unicode, unsigned short size);
- wchar_t* getPSName();
- float* getLineMetrics();
- bool canDisplay(unsigned short c);
+ Glyph* createGlyph(ufshort unicode, ufshort size);
+ fwchar_t* getPSName();
+ ffloat* getLineMetrics();
+ bool canDisplay(ufshort c);
- unsigned short getUnicodeByIndex(unsigned short ind);
+ ufshort getUnicodeByIndex(ufshort ind);
-// float* GetExtraMetrics();
+// ffloat* GetExtraMetrics();
private:
@@ -51,9 +51,9 @@
Type1GlyphCodeMap glyphCodeMap;//glyphCode -- unicode
- wchar_t *fullName;
+ fwchar_t *fullName;
- float matrixScale;
+ ffloat matrixScale;
};
#endif //__TYPE_1_FONT_CLASS_H