diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx index ef03aa3..e0be19f 100644 --- a/vcl/generic/glyphs/gcach_layout.cxx +++ b/vcl/generic/glyphs/gcach_layout.cxx @@ -182,6 +182,14 @@ bool ServerFontLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutAr #include #include +#include +#include FT_FREETYPE_H +#include FT_GLYPH_H +#include FT_OUTLINE_H +#include FT_TRUETYPE_TABLES_H +#include FT_TRUETYPE_TAGS_H +#include FT_TRUETYPE_IDS_H + using namespace U_ICU_NAMESPACE; static const LEGlyphID ICU_DELETED_GLYPH = 0xFFFF; @@ -209,6 +217,7 @@ public: using LEFontInstance::mapCharToGlyph; virtual LEGlyphID mapCharToGlyph( LEUnicode32 ch ) const; + virtual LEGlyphID mapCharToGlyph( LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth ) const; virtual le_int32 getAscent() const; virtual le_int32 getDescent() const; @@ -222,6 +231,23 @@ public: const void* IcuFontFromServerFont::getFontTable( LETag nICUTableTag ) const { +#if 1 + //leaks, push this down to ServerFont and don't leak + FT_ULong len = 0; + FT_Byte *result = NULL; + + FT_Face fFace = mrServerFont.GetFtFace(); + + FT_Load_Sfnt_Table(fFace, nICUTableTag, 0, NULL, &len); + + if (len > 0) { + result = new FT_Byte[len]; + FT_Load_Sfnt_Table(fFace, nICUTableTag, 0, result, &len); + } + + return result; +#else + char pTagName[5]; pTagName[0] = (char)(nICUTableTag >> 24); pTagName[1] = (char)(nICUTableTag >> 16); @@ -238,6 +264,7 @@ const void* IcuFontFromServerFont::getFontTable( LETag nICUTableTag ) const fprintf(stderr,"font( h=%d, \"%s\" )\n", mnHeight, pName ); #endif return (const void*)pBuffer; +#endif } // ----------------------------------------------------------------------- @@ -286,6 +313,16 @@ LEGlyphID IcuFontFromServerFont::mapCharToGlyph( LEUnicode32 ch ) const return nGlyphIndex; } +LEGlyphID IcuFontFromServerFont::mapCharToGlyph( LEUnicode32 ch, const LECharMapper *mapper, le_bool /*filterZeroWidth*/ ) const +{ +/* icu has..., so only the Indic layouts allow the joiners to get mapped to glyphs + >│93 if (filterZeroWidth && (mappedChar == 0x200C || mappedChar == 0x200D)) { │ + │94 return canDisplay(mappedChar)? 0x0001 : 0xFFFF; │ + │95 } +*/ + return LEFontInstance::mapCharToGlyph( ch, mapper, false ); +} + // ----------------------------------------------------------------------- le_int32 IcuFontFromServerFont::getAscent() const @@ -436,13 +473,19 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr le_int32 eScriptCode = -1; for( int i = nMinRunPos; i < nEndRunPos; ++i ) { - eScriptCode = uscript_getScript( pIcuChars[i], &rcI18n ); - if( (eScriptCode > 0) && (eScriptCode != latnScriptCode) ) - break; + le_int32 eNextScriptCode = uscript_getScript( pIcuChars[i], &rcI18n ); + if( (eNextScriptCode > USCRIPT_INHERITED) ) + { + eScriptCode = eNextScriptCode; + if (eNextScriptCode != latnScriptCode) + break; + } } if( eScriptCode < 0 ) // TODO: handle errors better eScriptCode = latnScriptCode; + fprintf(stderr, "scriptcode is %d\n", eScriptCode); + // get layout engine matching to this script // no engine change necessary if script is latin if( !mpIcuLE || ((eScriptCode != meScriptCode) && (eScriptCode > USCRIPT_INHERITED)) ) @@ -463,6 +506,9 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr if( !mpIcuLE ) break; + if( pIcuChars[0] == 'A') + fprintf(stderr, "debug here\n"); // OpenTypeLayoutEngine.cpp:314 + // run ICU layout engine // TODO: get enough context, remove extra glyps below int nRawRunGlyphCount = mpIcuLE->layoutChars( pIcuChars, diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 67ef1fe..0f0d999 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -5886,22 +5886,6 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( String& rStr, nLayoutFlags |= SAL_LAYOUT_ENABLE_LIGATURES; else if( mnTextLayoutMode & TEXT_LAYOUT_COMPLEX_DISABLED ) nLayoutFlags |= SAL_LAYOUT_COMPLEX_DISABLED; - else - { - // disable CTL for non-CTL text - const sal_Unicode* pStr = rStr.GetBuffer() + nMinIndex; - const sal_Unicode* pEnd = rStr.GetBuffer() + nEndIndex; - for( ; pStr < pEnd; ++pStr ) - if( ((*pStr >= 0x0300) && (*pStr < 0x0370)) // diacritical marks - || ((*pStr >= 0x0590) && (*pStr < 0x10A0)) // many CTL scripts - || ((*pStr >= 0x1100) && (*pStr < 0x1200)) // hangul jamo - || ((*pStr >= 0x1700) && (*pStr < 0x1900)) // many CTL scripts - || ((*pStr >= 0xFB1D) && (*pStr < 0xFE00)) // middle east presentation - || ((*pStr >= 0xFE70) && (*pStr < 0xFEFF)) ) // arabic presentation B - break; - if( pStr >= pEnd ) - nLayoutFlags |= SAL_LAYOUT_COMPLEX_DISABLED; - } if( meTextLanguage ) //TODO: (mnTextLayoutMode & TEXT_LAYOUT_SUBSTITUTE_DIGITS) {