Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 37157 invoked from network); 10 Jun 2007 17:31:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jun 2007 17:31:56 -0000 Received: (qmail 3367 invoked by uid 500); 10 Jun 2007 17:31:58 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 3331 invoked by uid 500); 10 Jun 2007 17:31:58 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 3181 invoked by uid 99); 10 Jun 2007 17:31:57 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jun 2007 10:31:57 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jun 2007 10:31:47 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 851A31A9825; Sun, 10 Jun 2007 10:31:27 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r545915 [5/5] - in /harmony/enhanced/classlib/trunk/modules/awt: ./ src/main/java/common/java/awt/ src/main/java/common/org/apache/harmony/awt/gl/ src/main/java/common/org/apache/harmony/awt/gl/font/ src/main/java/common/org/apache/harmony/... Date: Sun, 10 Jun 2007 17:31:25 -0000 To: commits@harmony.apache.org From: apetrenko@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070610173127.851A31A9825@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/T1Glyph.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/T1Glyph.cpp?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/T1Glyph.cpp (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/T1Glyph.cpp Sun Jun 10 10:31:22 2007 @@ -0,0 +1,494 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @author Viskov Nikolay + * @version $Revision$ + */ +#include "T1Glyph.h" + +T1Glyph::T1Glyph(Type1Map *charStringMap, Type1Map *subrsMap, unsigned short unicode, unsigned short size, float relativeSize, float* fontBB):Glyph() { + _charStringMap = charStringMap; + _subrsMap = subrsMap; + _unicode = unicode; + _size = size; + _relativeSize = relativeSize; + + _advanceX = 0; + _advanceY = 0; + + _glyphBB[0] = fontBB[0] * relativeSize; + _glyphBB[1] = fontBB[1] * relativeSize; + _glyphBB[2] = fontBB[2] * relativeSize; + _glyphBB[3] = fontBB[3] * relativeSize; +} + +T1Glyph::~T1Glyph() { +} + +void T1Glyph::parseValueToOutline(EncodedValue *value, std::stack *stack, Outline *out, float *curX, float *curY, float relativeSize){ + float x1, y1, x2, y2, x3, y3; + + unsigned char curChar; + + for (unsigned short count = 0; count < value->length; count ++) { + + curChar = value->text[count]; + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("\nchar = %u, ", curChar); + #endif + + if (curChar > 31) { + if (curChar > 31 && curChar < 247) { // -107 to 107 + stack->push((float) (curChar - 139)); + } else if (curChar > 246 && curChar < 251) { // 108 to 1131 + stack->push((float) ((curChar - 247) * 256 + 108 + (unsigned char)(value->text[++count]))); + } else if (curChar > 250 && curChar < 255) { // -1131 to -108 + stack->push((float) ((curChar - 251) * (-256) - 108 - (unsigned char)(value->text[++count]))); + } else if (curChar == 255) { // int + stack->push((float) ((curChar << 24) + (unsigned char)((value->text[++count]) << 16) + + (unsigned char)((value->text[++count]) << 8) + (unsigned char)(value->text[++count]))); + } + } else { + switch (curChar) { + case CH_STR_VMOVETO: {// vmoveto + *curY += stack->top() * relativeSize; + stack->pop(); + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("moveTo( %f, %f), ",*curX, *curY); + #endif + out->moveTo(*curX, *curY); + break; + } + case CH_STR_RLINETO : {// rlineto + *curY += (float) stack->top() * relativeSize; + stack->pop(); + *curX += (float) stack->top() * relativeSize; + stack->pop(); + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("lineTo( %f, %f), ",*curX, *curY); + #endif + out->lineTo(*curX, *curY); + break; + } + case CH_STR_HLINETO : {// hlineto + *curX += (float) stack->top() * relativeSize; + stack->pop(); + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("lineTo( %f, %f), ",*curX, *curY); + #endif + out->lineTo(*curX, *curY); + break; + } + case CH_STR_VLINETO : {// vlineto + *curY += (float) stack->top() * relativeSize; + stack->pop(); + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("lineTo( %f, %f), ",*curX, *curY); + #endif + out->lineTo(*curX, *curY); + break; + } + case CH_STR_RRCURVETO : {// rrcurveto equivalent to dx1 dy1 (dx1+dx2) (dy1+dy2) (dx1+dx2+dx3) (dy1+dy2+dy3) rcurveto. + y3 = (float) stack->top() * relativeSize; + stack->pop(); + x3 = (float) stack->top() * relativeSize; + stack->pop(); + y2 = (float) stack->top() * relativeSize; + stack->pop(); + x2 = (float) stack->top() * relativeSize; + stack->pop(); + y1 = (float) stack->top() * relativeSize; + stack->pop(); + x1 = (float) stack->top() * relativeSize; + stack->pop(); + + x1 += *curX; + y1 += *curY; + x2 += x1; + y2 += y1; + x3 += x2; + y3 += y2; + *curX = x3; + *curY = y3; + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("curveTo( %f, %f, %f, %f, %f, %f), ",x1, y1, x2, y2, x3, y3); + #endif + out->curveTo(x1, y1, x2, y2, x3, y3); + break; + } + //case CH_STR_ENDCHAR : + case CH_STR_CLOSEPATH : {// closePath + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("closePath"); + #endif + out->closePath(); + break; + } + case CH_STR_CALLSUBR : {// callsubr + x1 = (float) stack->top(); + stack->pop(); + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("call subr = %f, ", x1); + #endif + + parseValueToOutline((*_subrsMap)[(const unsigned short)x1], stack, out, curX, curY, relativeSize); + break; + } + case CH_STR_HSBW : {// hsbw + y1 = (float) stack->top() * relativeSize; + stack->pop(); + x1 = (float) stack->top() * relativeSize; + stack->pop(); + + _advanceX = y1; + _advanceY = 0; + + _glyphBB[0] = x1; + _glyphBB[2] = y1; + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("hsbw = %f,%f ; ", x1, y1); + #endif + + *curX = x1; + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("moveTo( %f, %f), ",*curX, *curY); + #endif + + out->moveTo(*curX, *curY); + break; + } + case CH_STR_RMOVETO : {// rmoveto + *curY += (float) stack->top() * relativeSize; + stack->pop(); + *curX += (float) stack->top() * relativeSize; + stack->pop(); + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("moveTo( %f, %f), ",*curX, *curY); + #endif + out->moveTo(*curX, *curY); + break; + } + case CH_STR_HMOVETO : {// hmoveto + *curX += (float) stack->top() * relativeSize; + stack->pop(); + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("moveTo( %f, %f), ",*curX, *curY); + #endif + out->moveTo(*curX, *curY); + break; + } + case CH_STR_VHCURVETO : {// vhcurveto + y3 = 0; + x3 = (float) stack->top() * relativeSize; + stack->pop(); + y2 = (float) stack->top() * relativeSize; + stack->pop(); + x2 = (float) stack->top() * relativeSize; + stack->pop(); + y1 = (float) stack->top() * relativeSize; + stack->pop(); + x1 = 0; + + x1 += *curX; + y1 += *curY; + x2 += x1; + y2 += y1; + x3 += x2; + y3 += y2; + *curX = x3; + *curY = y3; + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("curveTo( %f, %f, %f, %f, %f, %f), ",x1, y1, x2, y2, x3, y3); + #endif + out->curveTo(x1, y1, x2, y2, x3, y3); + break; + } + case CH_STR_HVCURVETO : {// hvcurveto + y3 = (float) stack->top() * relativeSize; + stack->pop(); + x3 = 0; + y2 = (float) stack->top() * relativeSize; + stack->pop(); + x2 = (float) stack->top() * relativeSize; + stack->pop(); + y1 = 0; + x1 = (float) stack->top() * relativeSize; + stack->pop(); + + x1 += *curX; + y1 += *curY; + x2 += x1; + y2 += y1; + x3 += x2; + y3 += y2; + *curX = x3; + *curY = y3; + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("curveTo( %f, %f, %f, %f, %f, %f), ",x1, y1, x2, y2, x3, y3); + #endif + out->curveTo(x1, y1, x2, y2, x3, y3); + break; + } + case CH_STR_ESCAPE : {// escape command + curChar = value->text[++count]; + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("escape command = %u, ", curChar); + #endif + if (curChar == CH_STR_ESCAPE_SEAC) {//seak + x3 = (float) stack->top(); + stack->pop(); + y2 = (float) stack->top(); + stack->pop(); + x2 = (float) stack->top() * relativeSize; + stack->pop(); + y1 = (float) stack->top() * relativeSize; + stack->pop(); + x1 = (float) stack->top() * relativeSize; + stack->pop(); + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("seak = %f,%f,%f,%f,%f ; ", x1, y1, x2, y2, x3); + #endif + + unsigned short aX = (unsigned short) _advanceX; + unsigned short aY = (unsigned short) _advanceY; + + float tempGlyphBB[4]; + + memcpy(tempGlyphBB, _glyphBB, 4 * sizeof(float)); + + parseValueToOutline((*_charStringMap)[STANDART_ENCODING[(unsigned short)y2]], stack, out, curX, curY, relativeSize); + + *curY = x2; + *curX = y1; + out->moveTo(*curX, *curY); + + parseValueToOutline((*_charStringMap)[STANDART_ENCODING[(unsigned short)x3]], stack, out, curX, curY, relativeSize); + + _advanceX = aX; + _advanceY = aY; + + memcpy(_glyphBB, tempGlyphBB, 4 * sizeof(float)); + + break; + } else if (curChar == CH_STR_ESCAPE_SBW) { //sbw + y2 = (float) stack->top() * relativeSize; + stack->pop(); + x2 = (float) stack->top() * relativeSize; + stack->pop(); + y1 = (float) stack->top() * relativeSize; + stack->pop(); + x1 = (float) stack->top() * relativeSize; + stack->pop(); + + _advanceX = x1; + _advanceY = y1; + + _glyphBB[0] = x1; + _glyphBB[1] = y1; + _glyphBB[2] = x2; + _glyphBB[3] = y2; + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("sbw = %f,%f,%f,%f ; ", x1, y1, x2, y2); + #endif + + *curX = x2; + *curY = y2; + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("moveTo( %f, %f), ",*curX, *curY); + #endif + out->moveTo(*curX, *curY); + break; + } else if (curChar == CH_STR_ESCAPE_DIV) {//div + y1 = (float) stack->top(); + stack->pop(); + x1 = (float) stack->top(); + stack->pop(); + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("div (%f/%f) ", x1, y1); + #endif + stack->push(x1 / y1); + break; + } else { + } + } + } + } + } +} + +void T1Glyph::countPoints(std::stack *stack, EncodedValue *value, unsigned short *point, unsigned short *command) { + unsigned char curChar; + + for (unsigned short count = 0; count < value->length; count ++) { + + curChar = value->text[count]; + + if (curChar > 31) { + if (curChar > 31 && curChar < 247) { // -107 to 107 + stack->push((float) (curChar - 139)); + } else if (curChar > 246 && curChar < 251) { // 108 to 1131 + stack->push((float) ((curChar - 247) * 256 + 108 + (unsigned char)(value->text[++count]))); + } else if (curChar > 250 && curChar < 255) { // -1131 to -108 + stack->push((float) ((curChar - 251) * (-256) - 108 - (unsigned char)(value->text[++count]))); + } else if (curChar == 255) { // int + stack->push((float) ((curChar << 24) + (unsigned char)((value->text[++count]) << 16) + + (unsigned char)((value->text[++count]) << 8) + (unsigned char)(value->text[++count]))); + } + } else { + switch (curChar) { + case CH_STR_RLINETO: + case CH_STR_HLINETO: + case CH_STR_VLINETO: + case CH_STR_VMOVETO: + case CH_STR_RMOVETO: + case CH_STR_HMOVETO: + case CH_STR_HSBW: {// HSBW + *point += 2; + *command += 1; + break; + } + case CH_STR_RRCURVETO: + case CH_STR_VHCURVETO: + case CH_STR_HVCURVETO: {// rrcurveto equivalent to dx1 dy1 (dx1+dx2) (dy1+dy2) (dx1+dx2+dx3) (dy1+dy2+dy3) rcurveto. + *point += 6; + *command += 1; + break; + } + //case CH_STR_ENDCHAR : + case CH_STR_CLOSEPATH : {// closePath + *command += 1; + break; + } + case CH_STR_CALLSUBR : {// callsubr + unsigned short com = (unsigned short) stack->top(); + stack->pop(); + + countPoints(stack, (*_subrsMap)[com], point, command); + break; + } + case CH_STR_ESCAPE : {// escape command + curChar = value->text[++count]; + if (curChar == CH_STR_ESCAPE_DIV) {//div + break; + } else if (curChar == CH_STR_ESCAPE_SEAC) {//seac + unsigned short achar = (unsigned short) stack->top(); + stack->pop(); + unsigned short bchar = (unsigned short) stack->top(); + stack->pop(); + + *point += 2; + *command += 1; + + countPoints(stack, (*_charStringMap)[STANDART_ENCODING[bchar]], point, command); + countPoints(stack, (*_charStringMap)[STANDART_ENCODING[achar]], point, command); + + break; + } else if (curChar == CH_STR_ESCAPE_SBW) { //sbw + *point += 2; + *command += 1; + break; + } + break; + } + } + } + } +} + +float* T1Glyph::getGlyphMetrics(void){ + if ((_advanceX == 0) && (_advanceY == 0)) { + getOutline(); + } + + float* gMetrics = new float[6]; + + gMetrics[0] = _advanceX; + gMetrics[1] = _advanceY; + gMetrics[2] = _glyphBB[0]; + gMetrics[3] = _glyphBB[1]; + gMetrics[4] = _glyphBB[2]; + gMetrics[5] = _glyphBB[3]; + + return gMetrics; +} + +Outline* T1Glyph::getOutline(void){ + float curX, curY; + curX = curY = 0; + unsigned short point, command; + point = command = 0; + Outline *out;// = new Outline((unsigned short)200,(unsigned short)200); + std::stack *stack = new std::stack(); + EncodedValue *value; + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("\n"); + #endif + Type1Map::iterator iter = _charStringMap->find(_unicode); + if (iter == _charStringMap->end()) { + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("default\n"); + #endif + value = (*_charStringMap)[0]; + } else { + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("found value\n"); + #endif + value = (EncodedValue *)iter->second; + } + + if (!value) { + delete stack; + return NULL; + } + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("_unicode = %u\n",_unicode); + #endif + + countPoints( stack, value, &point, &command); + + #ifdef GLYPH_OUTLINE_CREATE_DEBUG + printf("final point = %u, command = %u\n", point, command); + #endif + + out = new Outline(point, command); + + parseValueToOutline(value, stack, out, &curX, &curY, _relativeSize); + + delete stack; + + //out->trim(); + + return out; +} Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/T1Glyph.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/T1Glyph.h URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/T1Glyph.h?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/T1Glyph.h (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/T1Glyph.h Sun Jun 10 10:31:22 2007 @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @author Viskov Nikolay + * @version $Revision$ + */ +#ifndef __TYPE_1_GLYPH_CLASS_H +#define __TYPE_1_GLYPH_CLASS_H + +#include +#include "Glyph.h" +#include "Outline.h" +#include "Type1Structs.h" + +class T1Glyph : public Glyph { +private: + Type1Map *_charStringMap; + Type1Map *_subrsMap; + + float _relativeSize; + float _glyphBB[4]; + + void parseValueToOutline(EncodedValue *value, std::stack *stack, Outline *out, float *curX, float *curY, float relativeSize); + void countPoints(std::stack *stack, EncodedValue *value, unsigned short *point, unsigned short *command); + +public: + T1Glyph(Type1Map *charStringMap, Type1Map *subrsMap, unsigned short unicode, unsigned short size, float relativeSize, float* fontBB); + ~T1Glyph(); + Outline* getOutline(void); + float* getGlyphMetrics(void); +}; + +#endif //__TYPE_1_GLYPH_CLASS_H Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/T1Glyph.h ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTCurve.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTCurve.cpp?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTCurve.cpp (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTCurve.cpp Sun Jun 10 10:31:22 2007 @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @author Dmitriy S. Matveev + * @version $Revision$ + */ +#include "TTCurve.h" +#include "memory.h" + +TTCurve::TTCurve() +{ + _len = 0; + _outlineCommandsNumb = 1; // for last closePath(); + _coords = 0; + _flags = 0; +} + +TTCurve::~TTCurve() +{ + delete[] _coords; + delete[] _flags; +} + +int TTCurve::add(float x, float y, unsigned char flag) +{ + _len +=2; + + if (flag == OPEN_FLAG && _outlineCommandsNumb) + _outlineCommandsNumb+=2; + else if (flag != 0) + _outlineCommandsNumb++; + + float* tmpC = _coords; + unsigned char* tmpF = _flags; + + _coords = new float[_len]; + _flags = new unsigned char[(_len+1)/2]; + + memcpy(_coords,tmpC,(_len-2)*sizeof(float)); + _coords[_len-2] = x; + _coords[_len-1] = y; + + memcpy(_flags,tmpF,(_len-1)/2); + _flags[(_len-1)/2] = flag; + + delete[] tmpC; + delete[] tmpF; + return 0; +} Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTCurve.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTCurve.h URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTCurve.h?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTCurve.h (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTCurve.h Sun Jun 10 10:31:22 2007 @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @author Dmitriy S. Matveev + * @version $Revision$ + */ +#ifndef __CURVE_H__ +#define __CURVE_H__ + +enum{OPEN_FLAG=1, FLAG_ONCURVE=2}; + +class TTCurve +{ +public: + + TTCurve(); + ~TTCurve(); + + float* _coords; + unsigned char* _flags; + unsigned short _len; + unsigned short _outlineCommandsNumb; + + int add(float x, float y, unsigned char flag); + +}; + +#endif Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTCurve.h ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTFont.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTFont.cpp?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTFont.cpp (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTFont.cpp Sun Jun 10 10:31:22 2007 @@ -0,0 +1,286 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @author Dmitriy S. Matveev + * @version $Revision$ + */ +#include "TTFont.h" +#include "Tables.h" + +TTFont::TTFont(char* pathToFile):Font() +{ + _pathToFile=pathToFile; + _glyphOffsets.offsets = NULL; + _tableEncode.TableEncode = NULL; + _famName = NULL; + _ttfile = NULL; + _hMetrics = NULL; + _psName = NULL; + + _ttfile = fopen(_pathToFile,"rb"); + parseNameTable(_ttfile, &_famName, &_psName, NULL); + parseCmapTable(_ttfile, &_tableEncode); + parseMaxpTable(_ttfile, &_numGlyphs); + parseHeadTable(_ttfile, _boundingBox, &(_glyphOffsets.format), &_unitsPerEm); + for (int i=0; i<4; i++) + _boundingBox[i]/=(float)(_unitsPerEm); + parseLocaTable(_ttfile, &(_glyphOffsets), _numGlyphs); + parseHheaTable(_ttfile, &_numOfHMetrics, &_ascent, &_descent, &_externalLeading); + + _ascent/=(float)(_unitsPerEm); + _descent = ((_descent>0)?_descent:(-_descent))/_unitsPerEm; + _externalLeading/=(float)(_unitsPerEm); + + parseHmtxTable(_ttfile, _numOfHMetrics, &_hMetrics); + fclose(_ttfile); +} + +TTFont::~TTFont(void) +{ + delete[] _glyphOffsets.offsets; + delete[] (int*)(_tableEncode.TableEncode); + delete[] _psName; + delete[] _hMetrics; +} + +Glyph* TTFont::createGlyph(unsigned short unicode, unsigned short size) +{ + TTGlyph *gl = new TTGlyph(this, unicode, size); + if (gl->_index < _numOfHMetrics) + gl->_advanceX = _hMetrics[gl->_index].adwance_width*(float)(size)/(float)(_unitsPerEm); + else + gl->_advanceX = _hMetrics[_numOfHMetrics-1].adwance_width*(float)(size)/(float)(_unitsPerEm); + gl->_advanceY = 0; + return gl; +} + +unsigned short TTFont::getGlyphIndex(unsigned short symb) +{ + unsigned short index = 0; + + if (_tableEncode.format == 0) + { + unsigned char* te = (unsigned char*)_tableEncode.TableEncode; + index = te[symb]; + + }else if (_tableEncode.format == 4) + { + unsigned short segCountX2; + unsigned short segCount; +// unsigned short search_range; +// unsigned short entry_selector; +// unsigned short range_shift; + unsigned short* end_count; + unsigned short* start_count; + unsigned short* idDelta; + unsigned short* idRangeOffset; + unsigned short reservedPad; + unsigned short* te = (unsigned short*)(_tableEncode.TableEncode); + int i; + + segCountX2 = te[0]; + segCount = segCountX2/2; + end_count = te+4; + reservedPad = te[segCount+4]; + start_count = te+segCount+5; + idDelta = te+2*segCount+5; + idRangeOffset = te+3*segCount+5; + + for (i=0;i=start_count[i]) + { + break; + } + } + + if (idRangeOffset[i] != 0) + index = (*(idRangeOffset[i]/2 + (symb - start_count[i]) + &idRangeOffset[i]) + idDelta[i]) % 65536; + else + index = (symb + idDelta[i]) % 65536; + + } + return index; +} + +unsigned short TTFont::getUnicodeByIndex(unsigned short ind) +{ + unsigned short symb = 0; + + if (_tableEncode.format == 0) + { + unsigned char* te = (unsigned char*)_tableEncode.TableEncode; + for (unsigned short i = 0; i<=_numGlyphs; i++) + { + if (ind = te[i]) + { + symb = i; + break; + } + } + }else + if (_tableEncode.format == 4) + { + unsigned short segCountX2; + unsigned short segCount; + unsigned short* end_count; + unsigned short* start_count; + unsigned short* idDelta; + unsigned short* idRangeOffset; + unsigned short reservedPad; + unsigned short* te = (unsigned short*)(_tableEncode.TableEncode); + int i; + + segCountX2 = te[0]; + segCount = segCountX2/2; + end_count = te+4; + reservedPad = te[segCount+4]; + start_count = te+segCount+5; + idDelta = te+2*segCount+5; + idRangeOffset = te+3*segCount+5; + + for (i=0;i=start_count[i]) + { + break; + } + } + } + return symb; +} + +wchar_t* TTFont::getPSName() +{ + return _psName; +} + +float* TTFont::getLineMetrics() +{ +//printf("reading file...\n"); + _ttfile = fopen(_pathToFile,"rb"); + + float* ret = new float[8]; + ret[0] = _ascent; + ret[1] = _descent; + ret[2] = _externalLeading; + + short uOffset, uThickness; + +//printf("parsing POST table...\n"); + parsePostTable(_ttfile, &uOffset, &uThickness); + ret[3] = (float)uThickness/(float)(_unitsPerEm); + ret[4] = (float)uOffset/(float)(_unitsPerEm); + +//printf("parsing OS2 table...\n"); + parseOs2Table(_ttfile, &_strikeOutSize, &_strikeOutOffset); + + ret[5] = _strikeOutSize; + ret[6] = _strikeOutOffset; + + float width = _boundingBox[3]-_boundingBox[1]; + ret[7] = (width>0)?width:(-width); + + fclose(_ttfile); + + return ret; +} + +bool TTFont::canDisplay(unsigned short c) +{ + unsigned short index = getGlyphIndex(c); +#ifdef WIN32 + bool isComposite = isCompositeGlyph(_ttfile, _glyphOffsets, _numGlyphs, index); + if (index == 0 || index >= _numGlyphs || isComposite) + return false; +#else + if (index == 0 || index >= _numGlyphs) + return false; +#endif + return true; +} + +/* *************** */ +/* TTGlyph methods */ +/* *************** */ +TTGlyph::TTGlyph(TTFont* font, unsigned short unicode, unsigned short size):Glyph() +{ + _ttfont = font; + _unicode = unicode; + _size = size; + _curve = new TTCurve(); + _boundingRect[0]=0; + _boundingRect[1]=0; + _boundingRect[2]=0; + _boundingRect[3]=0; + + _ttfont->_ttfile = fopen(_ttfont->_pathToFile,"rb"); + _index = _ttfont->getGlyphIndex(_unicode); + parseGlyphData(_ttfont->_ttfile, _ttfont->_glyphOffsets,_ttfont->_numGlyphs,_index, _curve, _boundingRect, (float)_size/(float)(_ttfont->_unitsPerEm)); + fclose(_ttfont->_ttfile); +} + +TTGlyph::~TTGlyph() +{ + delete _curve; +} + +float* TTGlyph::getGlyphMetrics(void){ + float* gMetrics = new float[6]; + + gMetrics[0]=_advanceX; + gMetrics[1]=_advanceY; + gMetrics[2]=_boundingRect[0]; + gMetrics[3]=_boundingRect[1]; + gMetrics[4]=_boundingRect[2]; + gMetrics[5]=_boundingRect[3]; + + return gMetrics; +} + +Outline* TTGlyph::getOutline(void) +{ + Outline* outline = new Outline(_curve->_len,_curve->_outlineCommandsNumb); + + for (int i = 0; i<_curve->_len; i+=2) + { + switch(_curve->_flags[i/2]) + { + case OPEN_FLAG: + if (i!=0) outline->closePath(); + outline->moveTo(_curve->_coords[i],_curve->_coords[i+1]); + break; + case FLAG_ONCURVE: + if (_curve->_flags[i/2-1] & FLAG_ONCURVE || _curve->_flags[i/2-1] & OPEN_FLAG) + outline->lineTo(_curve->_coords[i],_curve->_coords[i+1]); + else + outline->quadTo(_curve->_coords[i-2],_curve->_coords[i-1],_curve->_coords[i],_curve->_coords[i+1]); + } + } + outline->closePath(); + + return outline; +} Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTFont.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTFont.h URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTFont.h?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTFont.h (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTFont.h Sun Jun 10 10:31:22 2007 @@ -0,0 +1,97 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @author Dmitriy S. Matveev + * @version $Revision$ + */ +#ifndef __TTFONT_H__ +#define __TTFONT_H__ + +#include "Font.h" +#include "Glyph.h" +#include "Outline.h" +#include "TTCurve.h" + +typedef struct +{ + short format; //format of the 'loca' table + unsigned long* offsets; +} GlyphOffsets; + +typedef struct +{ + short format; + void* TableEncode; +} TableEncode; + +typedef struct +{ + unsigned short adwance_width; + short lsb; +}HMetrics; + +class TTGlyph; + +class TTFont:public Font +{ +friend class TTGlyph; +private: + char* _pathToFile; // path to font file + wchar_t *_psName; // postscript name of font + GlyphOffsets _glyphOffsets; //glyphs offsets in font file + TableEncode _tableEncode; // table with indexes of glyphs + unsigned short _unitsPerEm; //size of em-square + unsigned short _numOfHMetrics; // for 'hmtx' table + HMetrics* _hMetrics; // horizontal metrics for all glyphs + FILE* _ttfile; + + unsigned short getGlyphIndex(unsigned short symb); + unsigned short getUnicodeByIndex(unsigned short ind); +// friend unsigned short TTGlyph::getGlyphIndex(unsigned short symb); +// friend int TTGlyph::initialize(); + +public: + TTFont(char* pathToFile); + ~TTFont(void); + + Glyph* createGlyph(unsigned short unicode, unsigned short size); + wchar_t* getPSName(); + float* getLineMetrics(); + bool canDisplay(unsigned short c); + +// float* GetExtraMetrics(); +}; + + +class TTGlyph : public Glyph { +private: + TTFont* _ttfont; + unsigned short _index; + TTCurve* _curve; + short _boundingRect[4]; + + + friend Glyph* TTFont::createGlyph(unsigned short unicode, unsigned short size); + +public: + TTGlyph(TTFont *font, unsigned short unicode, unsigned short size); + ~TTGlyph(); + Outline* getOutline(void); + float* getGlyphMetrics(void); +}; + +#endif //__TTFONT_H__ Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/TTFont.h ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/Tables.h URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/Tables.h?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/Tables.h (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/Tables.h Sun Jun 10 10:31:22 2007 @@ -0,0 +1,314 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @author Dmitriy S. Matveev + * @version $Revision$ + */ +#ifndef __TABLES_H__ +#define __TABLES_H__ + + +#include "TTCurve.h" +#include "TTFont.h" + +#define CMAP_TABLE "cmap" /* character to glyph mapping */ +#define GLYF_TABLE "glyf" /* glyph data */ +#define HEAD_TABLE "head" /* font header */ +#define HHEA_TABLE "hhea" /* horizontal header */ +#define HMTX_TABLE "hmtx" /* horizontal metrics */ +#define LOCA_TABLE "loca" /* index to location */ +#define MAXP_TABLE "maxp" /* maximum profile */ +#define NAME_TABLE "name" /* naming */ +#define POST_TABLE "post" /* PostScript */ +#define TTCF_TABLE "ttcf" /* TrueType font collection */ +#define KERN_TABLE "kern" /* Kerning table */ +#define BASE_TABLE "BASE" /* Baseline table */ +#define OS2_TABLE "OS/2" /* OS-metrics table */ + +#define WINDOWS_PLATFORM_ID 3 /* Windows platform identifier */ +#define FAMILY_NAME_ID 1 /* Family name identifier */ +#define SUBFAMILY_NAME_ID 2 /* Family name identifier */ +#define FULL_NAME_ID 4 /* Family name identifier */ +#define POSTSCRIPT_NAME_ID 6 /* Family name identifier */ + +#define SYMBOL_ENCODING 0 +#define UNICODE_ENCODING 1 +#define SHIFT_JIS_ENCODING 2 +#define BIG5_ENCODING 3 +#define PRC_ENCODING 4 + +typedef long Fixed; +typedef long long LONGDT; + +typedef enum +{ + ON_CURVE = 0x01, // on curve or not + REPEAT = 0x08, // next byte specifies the number of + //additional times this set of flags is to be repeated + X_POSITIVE = 0x12, // positive x-value + X_NEGATIVE = 0x02, // negative x-value + X_SAME = 0x10, // x is same + X_DWORD = 0x00, + + Y_POSITIVE = 0x24, // positive y-value + Y_NEGATIVE = 0x04, // negative y-value + Y_SAME = 0x20, // y is same + Y_DWORD = 0x00, +}; + +/* From Win GDI +typedef struct { + unsigned char bFamilyType; + unsigned char bSerifStyle; + unsigned char bWeight; + unsigned char bProportion; + unsigned char bContrast; + unsigned char bStrokeVariation; + unsigned char bArmStyle; + unsigned char bLetterform; + unsigned char bMidline; + unsigned char bXHeight; +} PANOSE; */ + +typedef struct +{ + Fixed version; + unsigned short num_tables; + unsigned short search_range; + unsigned short entry_selector; + unsigned short range_shift; +} Table_Offset; + +typedef struct +{ + char tag[4]; + unsigned long checkSum; + unsigned long offset; + unsigned long length; +} Table_Directory; + +typedef struct +{ + unsigned short platformID; + unsigned short encodingID; + unsigned short languageID; + unsigned short nameID; + unsigned short string_length; + unsigned short string_offset; +} Name_Entry; + +typedef struct +{ + unsigned short format; + unsigned short num_name_records; + unsigned short storage_offset; + Name_Entry name_record[1]; +} Table_name; + +/* TrueType 'maxp' table */ +typedef struct +{ + Fixed version; + unsigned short numGlyphs; // number of Glyphs + unsigned short maxPoints; + unsigned short maxContours; + unsigned short maxCompositePoints; + unsigned short maxCompositeContours; + unsigned short maxZones; + unsigned short maxTwilightPoints; + unsigned short maxStorage; + unsigned short maxFunctionDefs; + unsigned short maxInstructionDefs; + unsigned short maxStackElements; + unsigned short maxSizeOfInstructions; + unsigned short maxComponentElements; + unsigned short maxComponentDepth; +} Table_maxp; + +/* TrueType Font Header table */ +typedef struct +{ + Fixed table_version; + Fixed font_revision; + unsigned long checksum_adjust; + unsigned long magic_number; + unsigned short flags; + unsigned short units_per_EM; + LONGDT created; + LONGDT modified; + short xMin; + short yMin; + short xMax; + short yMax; + unsigned short mac_style; + unsigned short lowest_rec_PPEM; + short font_direction; + short index_to_loc_format; // format of 'loca' table + short glyph_data_format; +} Table_head; + +typedef struct +{ + Fixed table_version; + short ascender; /* typographic ascent */ + short descender; /* typographic descent */ + short line_gap; /* typographic line gap */ + unsigned short advance_width_max; /* Maximum advance width value in ‘hmtx’ table */ + short min_left_sidebearing; + short min_right_sidebearing; /* Min(aw - lsb - (xMax - xMin)) */ + short xMaxExtent; /* Max(lsb + (xMax - xMin)) */ + short caret_slope_rise; + short caret_slope_run; + short first_reserved; + short second_reserved; + short third_reserved; + short fourth_reserved; + short fifth_reserved; + short metric_data_format; + unsigned short number_of_hMetrics; +} Table_hhea; + +typedef struct +{ + unsigned short table_version; + short xAvgCharWidth; + unsigned short usWeightClass; + unsigned short usWidthClass; + short fsType; + short ySubscriptXSize; + short ySubscriptYSize; + short ySubscriptXOffset; + short ySubscriptYOffset; + short ySuperscriptXSize; + short ySuperscriptYSize; + short ySuperscriptXOffset; + short ySuperscriptYOffset; + short yStrikeoutSize; + short yStrikeoutPosition; + short sFamilyClass; +// PANOSE panose; + unsigned char panose[10]; + unsigned long ulUnicodeRange1; + unsigned long ulUnicodeRange2; + unsigned long ulUnicodeRange3; + unsigned long ulUnicodeRange4; + unsigned char achVendID[4]; + unsigned short fsSelection; + unsigned short usFirstCharIndex; + unsigned short usLastCharIndex; + unsigned short sTypoAscender; + unsigned short sTypoDescender; + unsigned short sTypoLineGap; + unsigned short sWinAscent; + unsigned short sWinDescent; + unsigned long ulCodePageRange1; + unsigned long ulCodePageRange2; +} Table_os2; + +typedef struct +{ + unsigned short platform; //identifier of platform + unsigned short encodingID; //identifier fo encoding + unsigned long table_offset; //offset of the encoding table +} Cmap_Entry; + +typedef struct +{ + unsigned short table_version; // =0 + unsigned short numSubTables; //number subtables + Cmap_Entry tableHeaders[1]; //headers of subtables +} Table_cmap; + +typedef struct +{ + Fixed format; //format type + Fixed italic_angle; + short underlineOffset; + short underlineThickness; + unsigned long isFixedPitch; + unsigned long minMemType42; + unsigned long maxMemType42; + unsigned long minMemType1; + unsigned long maxMemType1; +} Table_post; + +/* first part of the encoding table identical for all format of them */ +typedef struct +{ + unsigned short format; + unsigned short length; //length in bytes + unsigned short version; +} Table_encode_header; + +/* +typedef struct +{ + unsigned short format; // =0,2,4,6 + unsigned short length; // size + unsigned short version; + unsigned char map[256]; +} Table_encode_0; + + +typedef struct +{ +// unsigned short segCountX2; // 2 x segCount + unsigned short search_range; // 2 x (2**floor(log_2(segCount))) + unsigned short entry_selector; // log_2(search_range/2) + unsigned short range_shift; // 2 x segCount - search_range + unsigned short end_count[1]; // end characterCode for each segment, last =0xFFFF, length = segCount + unsigned short reservedPad; // = 0 + unsigned short start_count[1]; // Start character code for each segment, length = segCount + unsigned short idDelta[1]; // Delta for all character codes in segment, length = segCount + unsigned short idRangeOffset[1]; // Offsets into glyphIdArray or 0, length = segCount + unsigned short glyphIdArray[]; // Glyph index array (arbitrary length) +} Table_encode_4; +*/ + +typedef struct +{ + short number_of_contours; // <0 for composite glyph + short xMin; + short yMin; + short xMax; + short yMax; +} Glyph_header; + +template // n = number_of_contours from Glyph_header +struct SimpleGlyphDescription +{ + unsigned short endPtsOfContours[n]; + unsigned short instruction_length; +// unsigned char instructions[instruction_length]; +// unsigned char flags[n]; +// unsigned char(short) xCoordinates[n]; +// unsigned char(short) yCoordinates[n]; +}; + +int parseCmapTable(FILE* tt_file, TableEncode* te); +int parseNameTable(FILE* tt_file, wchar_t** familyName, wchar_t** psName, StyleName* fontStyle); +int parseHeadTable(FILE* tt_file, float* bbox, short* format, unsigned short* unitsPerEm); +int parseHheaTable(FILE* tt_file, unsigned short* numOfHMetrics, float* ascent, float* descent, float* lineGap); +int parseMaxpTable(FILE* tt_file, unsigned short *numGlyphs); +int parseLocaTable(FILE* tt_file, GlyphOffsets* gOffsets, unsigned short numGlyphs); +int parseOs2Table(FILE* tt_file, float* strikeOutSize, float* strikeOutOffset); +int parsePostTable(FILE* tt_file, short* uOffset, short* uThickness); +int parseGlyphData(FILE* tt_file, const GlyphOffsets gO, unsigned short numGlyphs, unsigned short glyphIndex, TTCurve *curve, short* bRect, float transform); +int parseHmtxTable(FILE* tt_file, unsigned short numOfHMetrics, HMetrics** hm); +bool isCompositeGlyph(FILE* tt_file, const GlyphOffsets gO, unsigned short numGlyphs, unsigned short glyphIndex); + +#endif Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/Tables.h ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/Type1Structs.h URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/Type1Structs.h?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/Type1Structs.h (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/Type1Structs.h Sun Jun 10 10:31:22 2007 @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @author Viskov Nikolay + * @version $Revision$ + */ + +#ifndef __TYPE_1_STRUCTS_H +#define __TYPE_1_STRUCTS_H + +#include +#include "EncodedValue.h" +#include "AGL.h" + +typedef std::map Type1Map; + +typedef std::map Type1GlyphCodeMap; + +typedef std::map Type1AFMMap; + +typedef enum DecodeStateTag {HEADER, PRIVATE_DIR, SUBRS_MASSIVE, CHAR_STRING} DecodeState; + +typedef std::map Type1CharMap;//inner glyph number -- unicode + +static const unsigned short MAX_STR_LENGHT = 1024; +static const unsigned short C1 = 52845; +static const unsigned short C2 = 22719; +static const unsigned short DEF_R_EXEC = 55665; +static const unsigned short DEF_LENIV = 4; +static const unsigned short DEF_R_CHARSTRING = 4330; + +static const unsigned char CH_STR_HSTEM = 1; +static const unsigned char CH_STR_VSTEM = 3; +static const unsigned char CH_STR_VMOVETO = 4; +static const unsigned char CH_STR_RLINETO = 5; +static const unsigned char CH_STR_HLINETO = 6; +static const unsigned char CH_STR_VLINETO = 7; +static const unsigned char CH_STR_RRCURVETO = 8; +static const unsigned char CH_STR_CLOSEPATH = 9; +static const unsigned char CH_STR_CALLSUBR = 10; +static const unsigned char CH_STR_RETURN = 11; +static const unsigned char CH_STR_ESCAPE = 12; +static const unsigned char CH_STR_HSBW = 13; +static const unsigned char CH_STR_ENDCHAR = 14; +static const unsigned char CH_STR_RMOVETO = 21; +static const unsigned char CH_STR_HMOVETO = 22; +static const unsigned char CH_STR_VHCURVETO = 30; +static const unsigned char CH_STR_HVCURVETO = 31; + +static const unsigned char CH_STR_ESCAPE_DOTSECTION = 0; +static const unsigned char CH_STR_ESCAPE_VSTEM3 = 1; +static const unsigned char CH_STR_ESCAPE_HSTEM3 = 2; +static const unsigned char CH_STR_ESCAPE_SEAC = 6; +static const unsigned char CH_STR_ESCAPE_SBW = 7; +static const unsigned char CH_STR_ESCAPE_DIV = 12; +static const unsigned char CH_STR_ESCAPE_CALLOTHERSUBR = 16; +static const unsigned char CH_STR_ESCAPE_POP = 17; +static const unsigned char CH_STR_ESCAPE_SETCURRENTPOINT = 33; + +//#define GLYPH_OUTLINE_CREATE_DEBUG + +#endif //__TYPE_1_STRUCTS_H Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/Type1Structs.h ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/fljni.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/fljni.cpp?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/fljni.cpp (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/fljni.cpp Sun Jun 10 10:31:22 2007 @@ -0,0 +1,336 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "fljni.h" + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontManager + * Method: initManager + * Signature: (Ljava/lang/String;Ljava/lang/Class;)V + */ + +static jclass fontClass; +static jclass outlineClass; +static jmethodID setOutline; +static jmethodID fontConstructor; + +JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_initManager +(JNIEnv *env, jobject obj) { + +// jboolean iscopy; + + //printf("getting fonts...\n"); + Environment::getAllFonts(); + //printf("fonts added\n"); +#ifdef WIN32 + //char *nativePath = (char *)(env->GetStringUTFChars(path, &iscopy)); + + //Environment::addPath(nativePath); + + //env->ReleaseStringUTFChars(path, nativePath); +#endif + + + fontClass = env->FindClass("java/awt/Font"); + outlineClass = env->FindClass("org/apache/harmony/awt/gl/font/fontlib/FLOutline"); + fontConstructor = env->GetMethodID(fontClass, "", "(Ljava/lang/String;II)V"); + setOutline = env->GetMethodID(outlineClass, "setOutline", "([B[F)V"); +} + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontManager + * Method: getAllFontsNative + * Signature: ()[Ljava/awt/Font; + */ +JNIEXPORT jobjectArray JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_getAllFontsNative +(JNIEnv *env, jobject obj) { + + Environment::getAllFonts(); + + if (Environment::_length == 0) return NULL; + + fontClass = env->FindClass("java/awt/Font"); + + jobjectArray fonts = env->NewObjectArray(Environment::_length, fontClass, NULL ); + + FontHeader *fh = Environment::getAllFonts(); + + for (unsigned short i = 0; i < Environment::_length; i ++){ +#ifndef WIN32 + unsigned short fName[wcslen((wchar_t *)fh->_familyName)]; + for(unsigned short a = 0; a_familyName); a++){ + fName[a]=(unsigned short)(fh->_familyName[a]); + } +#endif + + env->SetObjectArrayElement(fonts, i, env->NewObject( + fontClass, + fontConstructor, +#ifdef WIN32 + env->NewString((jchar *)fh->_familyName, (jsize) wcslen((wchar_t *)fh->_familyName)), +#else + env->NewString((jchar*)fName, (jsize) wcslen((wchar_t *)fh->_familyName)), +#endif + (jint) (char) fh->_style, + (jint) 1 + )); + fh = fh->_nextHeader; + } + + return fonts; +} + +JNIEXPORT jobject JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_addFont +(JNIEnv *env, jobject obj, jstring fontPath, jint type) { + jboolean iscopy; + + fontClass = env->FindClass("java/awt/Font"); + + char *nativePath = (char *)(env->GetStringUTFChars(fontPath, &iscopy)); + + FontHeader *fh = Environment::addFile(nativePath, (FontType)type); + + env->ReleaseStringUTFChars(fontPath, nativePath); + + if (fh == NULL) return NULL; + + return env->NewObject( + fontClass, + fontConstructor, + env->NewString((jchar *)fh->_familyName, (jsize) wcslen((wchar_t *)fh->_familyName)), + (jint) (char) fh->_style, + (jint) 1 + ); +} + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontManager + * Method: dispose + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_dispose +(JNIEnv *env, jobject obj) { + delete Environment::getAllFonts(); +} + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: initFLFontPeer + * Signature: (Ljava/lang/String;I)J + */ +JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_initFLFontPeer +(JNIEnv *env, jobject obj, jstring fontName, jint style) { + jboolean iscopy; + + //char *getenv( const char *name ); + + char *tName = (char *)(env->GetStringUTFChars(fontName, &iscopy)); + + Font *font = createFont(tName, (StyleName) style); + + env->ReleaseStringUTFChars(fontName, tName); + + //if(!font) { + // printf("File not found !!!\n"); + //} + + #ifdef WIN32 + return (jlong) font; + #else + return (jlong) (long) font; + #endif +} + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: getLineMetrics + * Signature: (J)[I + */ +JNIEXPORT jfloatArray JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_getLineMetrics +(JNIEnv *env, jobject obj, jlong ptr) { + #ifdef WIN32 + Font *font = (Font *) ptr; + #else + Font *font = (Font *) (long)ptr; + #endif + + jfloatArray metrics = env->NewFloatArray((jsize) FONT_METRICS_QUANTITY); + float *buffer = (float *)env->GetPrimitiveArrayCritical(metrics, NULL); + +//printf("getting line metrics...\n"); + float *lineMetrics; + memcpy(buffer, lineMetrics = font->getLineMetrics(), FONT_METRICS_QUANTITY * sizeof(float)); +//printf("line metrics gotten"); + + delete[] lineMetrics; + + env->ReleasePrimitiveArrayCritical(metrics, buffer, 0); + + return metrics; +} + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: getPSName + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_getPSName +(JNIEnv *env, jobject obj, jlong ptr) { + #ifdef WIN32 + Font *font = (Font *) ptr; + #else + Font *font = (Font *) (long)ptr; + #endif + + wchar_t *psName = font->getPSName(); + + return env->NewString((jchar *) psName, (jsize) wcslen(psName)); +} + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: getMissingGlyphCode + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_getMissingGlyphCode +(JNIEnv *env, jobject obj, jlong ptr) { + #ifdef WIN32 + Font *font = (Font *) ptr; + #else + Font *font = (Font *) (long)ptr; + #endif + + return (jint) font->getMissingGlyphCode(); +} + +JNIEXPORT jchar JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_getUnicodeByIndex +(JNIEnv *env, jobject obj, jint index, jlong ptr) { + #ifdef WIN32 + Font *font = (Font *) ptr; + #else + Font *font = (Font *) (long)ptr; + #endif + + return (jchar) font->getUnicodeByIndex((unsigned short) index); +} + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: dispose + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_dispose +(JNIEnv *env, jobject obj, jlong ptr) { + #ifdef WIN32 + delete (Font *) ptr; + #else + delete (Font *) (long) ptr; + #endif +} + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: canDisplay + * Signature: (CJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_canDisplay +(JNIEnv *env, jobject obj, jchar ch, jlong ptr) { + #ifdef WIN32 + Font *font = (Font *) ptr; + #else + Font *font = (Font *) (long)ptr; + #endif + + return font->canDisplay((unsigned short)ch); +} + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLGlyph + * Method: getGlyphMetrics + * Signature: (J)[I + */ +JNIEXPORT jfloatArray JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLGlyph_getGlyphMetrics +(JNIEnv *env, jobject obj, jlong ptr) { + #ifdef WIN32 + Glyph *glyph = (Glyph *) ptr; + #else + Glyph *glyph = (Glyph *) (long)ptr; + #endif + + + jfloatArray metrics = env->NewFloatArray((jsize) GLYPH_METRICS_QUANTITY); + float *buffer = (float *)env->GetPrimitiveArrayCritical(metrics, NULL); + + memcpy(buffer, glyph->getGlyphMetrics(), GLYPH_METRICS_QUANTITY * sizeof(float)); + + env->ReleasePrimitiveArrayCritical(metrics, buffer, 0); + + return metrics; +} + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLGlyph + * Method: initGlyph + * Signature: (CIJ)J + */ +JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLGlyph_initGlyph +(JNIEnv *env, jobject obj, jchar ch, jint size, jlong ptr) { + #ifdef WIN32 + Font *font = (Font *) ptr; + return (jlong) font->getGlyph((unsigned short) ch, (unsigned short) size); + #else + Font *font = (Font *) (long)ptr; + return (jlong) (long) font->getGlyph((unsigned short) ch, (unsigned short) size); + #endif +} + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLPath + * Method: getShape + * Signature: ([B[FJ)J + */ +JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLPath_getShape +(JNIEnv * env, jobject obj, jobject outline, jlong ptr) { + #ifdef WIN32 + Glyph *glyph = (Glyph *) ptr; + #else + Glyph *glyph = (Glyph *) (long)ptr; + #endif + + Outline* out = glyph->getOutline(); + + out->trim(); + + jbyteArray commands = env->NewByteArray((jsize) out->getCommandLength()); + unsigned char *native_buffer = (unsigned char *)env->GetPrimitiveArrayCritical(commands, NULL); + + memcpy(native_buffer, out->_commands, out->getCommandLength()); + + env->ReleasePrimitiveArrayCritical(commands, native_buffer, 0); + + + jfloatArray points = env->NewFloatArray((jsize) out->getPointsLength()); + float *buffer = (float *)env->GetPrimitiveArrayCritical(points, NULL); + + memcpy(buffer, out->_points, out->getPointsLength() * sizeof(float)); + + env->ReleasePrimitiveArrayCritical(points, buffer, 0); + + env->CallVoidMethod(outline, setOutline, commands, points); + + delete out; +} Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/fljni.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/fljni.h URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/fljni.h?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/fljni.h (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/fljni.h Sun Jun 10 10:31:22 2007 @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __FONTLIB_JNI_H +#define __FONTLIB_JNI_H + +#include "org_apache_harmony_awt_gl_font_fontlib_FLFontManager.h" +#include "org_apache_harmony_awt_gl_font_fontlib_FLGlyph.h" +#include "org_apache_harmony_awt_gl_font_fontlib_FLPath.h" +#include "org_apache_harmony_awt_gl_font_fontlib_FLFontPeer.h" + +#include "Environment.h" +#include "Font.h" + +//#include + +#endif // __FONTLIB_JNI_H Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/fljni.h ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLFontManager.h URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLFontManager.h?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLFontManager.h (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLFontManager.h Sun Jun 10 10:31:22 2007 @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * THE FILE HAS BEEN AUTOGENERATED BY INTEL IJH TOOL. + * Please be aware that all changes made to this file manually + * will be overwritten by the tool if it runs again. + */ +#include +/* Header for class org_apache_harmony_awt_gl_font_fontlib_FLFontManager */ + +#ifndef _Included_org_apache_harmony_awt_gl_font_fontlib_FLFontManager +#define _Included_org_apache_harmony_awt_gl_font_fontlib_FLFontManager +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontManager + * Method: initManager + * Signature: (Ljava/lang/String;Ljava/lang/Class;)V + */ +JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_initManager + (JNIEnv *, jobject); + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontManager + * Method: getAllFontsNative + * Signature: ()[Ljava/awt/Font; + */ +JNIEXPORT jobjectArray JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_getAllFontsNative + (JNIEnv *, jobject); + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontManager + * Method: dispose + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_dispose + (JNIEnv *, jobject); + +JNIEXPORT jobject JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_addFont + (JNIEnv *, jobject, jstring, jint); + +#ifdef __cplusplus +} +#endif + +#endif /* _Included_org_apache_harmony_awt_gl_font_fontlib_FLFontManager */ Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLFontManager.h ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLFontPeer.h URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLFontPeer.h?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLFontPeer.h (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLFontPeer.h Sun Jun 10 10:31:22 2007 @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * THE FILE HAS BEEN AUTOGENERATED BY INTEL IJH TOOL. + * Please be aware that all changes made to this file manually + * will be overwritten by the tool if it runs again. + */ +#include +/* Header for class org_apache_harmony_awt_gl_font_fontlib_FLFontPeer */ + +#ifndef _Included_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer +#define _Included_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: initFLFontPeer + * Signature: (Ljava/lang/String;I)J + */ +JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_initFLFontPeer + (JNIEnv *, jobject, jstring, jint); + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: getLineMetrics + * Signature: (J)[I + */ +JNIEXPORT jfloatArray JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_getLineMetrics + (JNIEnv *, jobject, jlong); + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: getPSName + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_getPSName + (JNIEnv *, jobject, jlong); + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: getMissingGlyphCode + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_getMissingGlyphCode + (JNIEnv *, jobject, jlong); + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: dispose + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_dispose + (JNIEnv *, jobject, jlong); + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: canDisplay + * Signature: (CJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_canDisplay + (JNIEnv *, jobject, jchar, jlong); + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLFontPeer + * Method: getUnicodeByIndex + * Signature: (CJ)Z + */ +JNIEXPORT jchar JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_getUnicodeByIndex + (JNIEnv *, jobject, jint, jlong); + +#ifdef __cplusplus +} +#endif + +#endif /* _Included_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer */ Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLFontPeer.h ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLGlyph.h URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLGlyph.h?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLGlyph.h (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLGlyph.h Sun Jun 10 10:31:22 2007 @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * THE FILE HAS BEEN AUTOGENERATED BY INTEL IJH TOOL. + * Please be aware that all changes made to this file manually + * will be overwritten by the tool if it runs again. + */ +#include +/* Header for class org_apache_harmony_awt_gl_font_fontlib_FLGlyph */ + +#ifndef _Included_org_apache_harmony_awt_gl_font_fontlib_FLGlyph +#define _Included_org_apache_harmony_awt_gl_font_fontlib_FLGlyph +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLGlyph + * Method: getGlyphMetrics + * Signature: (J)[I + */ +JNIEXPORT jfloatArray JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLGlyph_getGlyphMetrics + (JNIEnv *, jobject, jlong); + +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLGlyph + * Method: initGlyph + * Signature: (CIJ)J + */ +JNIEXPORT jlong JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLGlyph_initGlyph + (JNIEnv *, jobject, jchar, jint, jlong); + +#ifdef __cplusplus +} +#endif + +#endif /* _Included_org_apache_harmony_awt_gl_font_fontlib_FLGlyph */ Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLGlyph.h ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLPath.h URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLPath.h?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLPath.h (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLPath.h Sun Jun 10 10:31:22 2007 @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * THE FILE HAS BEEN AUTOGENERATED BY INTEL IJH TOOL. + * Please be aware that all changes made to this file manually + * will be overwritten by the tool if it runs again. + */ +#include +/* Header for class org_apache_harmony_awt_gl_font_fontlib_FLPath */ + +#ifndef _Included_org_apache_harmony_awt_gl_font_fontlib_FLPath +#define _Included_org_apache_harmony_awt_gl_font_fontlib_FLPath +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_apache_harmony_awt_gl_font_fontlib_FLPath + * Method: getShape + * Signature: ([B[FJ)J + */ +JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_font_fontlib_FLPath_getShape + (JNIEnv *, jobject, jobject, jlong); + +#ifdef __cplusplus +} +#endif + +#endif /* _Included_org_apache_harmony_awt_gl_font_fontlib_FLPath */ Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/shared/include/org_apache_harmony_awt_gl_font_fontlib_FLPath.h ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/unix/exports.txt URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/unix/exports.txt?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/unix/exports.txt (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/unix/exports.txt Sun Jun 10 10:31:22 2007 @@ -0,0 +1,14 @@ +Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_initManager +Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_getAllFontsNative +Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_dispose +Java_org_apache_harmony_awt_gl_font_fontlib_FLFontManager_addFont +Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_initFLFontPeer +Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_getLineMetrics +Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_getPSName +Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_getMissingGlyphCode +Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_dispose +Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_canDisplay +Java_org_apache_harmony_awt_gl_font_fontlib_FLFontPeer_getUnicodeByIndex +Java_org_apache_harmony_awt_gl_font_fontlib_FLGlyph_getGlyphMetrics +Java_org_apache_harmony_awt_gl_font_fontlib_FLGlyph_initGlyph +Java_org_apache_harmony_awt_gl_font_fontlib_FLPath_getShape Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/unix/exports.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/unix/makefile URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/unix/makefile?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/unix/makefile (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/unix/makefile Sun Jun 10 10:31:22 2007 @@ -0,0 +1,43 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +include $(HY_HDK)/build/make/defines.mk + +CFLAGS += -fpic +INCLUDES += -I$(SHARED)common -I$(SHAREDSUB)include -I$(PNG_DIR) + +BUILDFILES = \ + $(SHAREDSUB)fljni.o \ + $(SHAREDSUB)EncodedValue.o \ + $(SHAREDSUB)Environment.o \ + $(SHAREDSUB)Font.o \ + $(SHAREDSUB)Glyph.o \ + $(SHAREDSUB)Outline.o \ + $(SHAREDSUB)ParsingTables.o \ + $(SHAREDSUB)T1Font.o \ + $(SHAREDSUB)T1Glyph.o \ + $(SHAREDSUB)TTCurve.o \ + $(SHAREDSUB)TTFont.o + +MDLLIBFILES += \ + $(LIBPATH)libhyzip.a $(DLLPATH)libhyzlib.so \ + $(LIBPATH)libhypool.a $(LIBPATH)libhyfdlibm.a $(LIBPATH)libvmi.so + +OSLIBS += $(STDCLIBS) + +DLLNAME=../libFL.so +EXPNAME=HYFONTLIB_0.1 + +include $(HY_HDK)/build/make/rules.mk Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/windows/fl.def URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/windows/fl.def?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/windows/fl.def (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/windows/fl.def Sun Jun 10 10:31:22 2007 @@ -0,0 +1,7 @@ +LIBRARY FL + +SECTIONS + .data READ WRITE + .text EXECUTE READ + +EXPORTS Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/windows/fl.rc URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/windows/fl.rc?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/windows/fl.rc (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/windows/fl.rc Sun Jun 10 10:31:22 2007 @@ -0,0 +1,48 @@ +; +; Licensed to the Apache Software Foundation (ASF) under one or more +; contributor license agreements. See the NOTICE file distributed with +; this work for additional information regarding copyright ownership. +; The ASF licenses this file to You under the Apache License, Version 2.0 +; (the "License"); you may not use this file except in compliance with +; the License. You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, +; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +; See the License for the specific language governing permissions and +; limitations under the License. +; + +#include +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,1,0,0 + PRODUCTVERSION 0,1,0,0 + FILEFLAGSMASK 0x3fL + FILEFLAGS 0x0L + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "The Apache Software Foundation.\0" + VALUE "FileDescription", "FontLib native code\0" + VALUE "FileVersion", "0.1\0" + VALUE "InternalName", "FL\0" + VALUE "LegalCopyright", "(c) Copyright 2007 The Apache Software Foundation or its licensors, as applicable.\0" + VALUE "OriginalFilename", "FL.dll\0" + VALUE "ProductName", "Apache Harmony\0" + VALUE "ProductVersion", "0.1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1200 + END +END Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/windows/makefile URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/windows/makefile?view=auto&rev=545915 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/windows/makefile (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/fontlib/windows/makefile Sun Jun 10 10:31:22 2007 @@ -0,0 +1,49 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +!include <$(HY_HDK)\build\make\defines.mak> + +LIBBASE=FL +DLLNAME=..\$(LIBBASE).dll +LIBNAME=$(LIBPATH)$(LIBBASE).lib +HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def + +HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)include /I$(SHAREDSUB) \ + /EHsc + +BUILDFILES = \ + $(SHAREDSUB)fljni.obj \ + $(SHAREDSUB)EncodedValue.obj \ + $(SHAREDSUB)Environment.obj \ + $(SHAREDSUB)Font.obj \ + $(SHAREDSUB)Glyph.obj \ + $(SHAREDSUB)Outline.obj \ + $(SHAREDSUB)ParsingTables.obj \ + $(SHAREDSUB)T1Font.obj \ + $(SHAREDSUB)T1Glyph.obj \ + $(SHAREDSUB)TTCurve.obj \ + $(SHAREDSUB)TTFont.obj + +VIRTFILES = $(LIBBASE).res +SYSLIBFILES = ws2_32.lib Iphlpapi.lib + +MDLLIBFILES = $(MDLLIBFILES) \ + $(LIBPATH)hypool.lib $(LIBPATH)vmi.lib \ + $(LIBPATH)hyzlib.lib + +DLLBASE=0x13300000 +COMMENT=/comment:"FontLib native code. (c) Copyright 2005 - 2007 The Apache Software Foundation or its licensors, as applicable." + +!include <$(HY_HDK)\build\make\rules.mak>