Disable code not needed with new HarfBuzz versions

Change-Id: I0526e2375f41f708ea26b5b81731a59de51825b7
Reviewed-on: https://gerrit.libreoffice.org/20229
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
This commit is contained in:
Khaled Hosny 2015-11-27 19:32:42 +04:00
parent 03c37cee47
commit e5cc49dbf1

View File

@ -34,6 +34,10 @@
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
#ifndef HB_VERSION_ATLEAST
#define HB_VERSION_ATLEAST(a,b,c) 0
#endif
// layout implementation for ServerFont
ServerFontLayout::ServerFontLayout( ServerFont& rFont )
: mrServerFont( rFont )
@ -162,6 +166,7 @@ static hb_position_t getGlyphAdvanceH(hb_font_t* /*font*/, void* pFontData,
return rGM.GetCharWidth() << 6;
}
#if !HB_VERSION_ATLEAST(1, 1, 2)
static hb_position_t getGlyphAdvanceV(hb_font_t* /*font*/, void* /*pFontData*/,
hb_codepoint_t /*nGlyphIndex*/,
void* /*pUserData*/)
@ -187,6 +192,7 @@ static hb_bool_t getGlyphOriginV(hb_font_t* /*font*/, void* /*pFontData*/,
// XXX: vertical origin
return true;
}
#endif
static hb_position_t getGlyphKerningH(hb_font_t* /*font*/, void* pFontData,
hb_codepoint_t nGlyphIndex1, hb_codepoint_t nGlyphIndex2,
@ -212,6 +218,7 @@ static hb_position_t getGlyphKerningH(hb_font_t* /*font*/, void* pFontData,
return ret;
}
#if !HB_VERSION_ATLEAST(1, 1, 2)
static hb_position_t getGlyphKerningV(hb_font_t* /*font*/, void* /*pFontData*/,
hb_codepoint_t /*nGlyphIndex1*/, hb_codepoint_t /*nGlyphIndex2*/,
void* /*pUserData*/)
@ -219,6 +226,7 @@ static hb_position_t getGlyphKerningV(hb_font_t* /*font*/, void* /*pFontData*/,
// XXX vertical kerning
return 0;
}
#endif
static hb_bool_t getGlyphExtents(hb_font_t* /*font*/, void* pFontData,
hb_codepoint_t nGlyphIndex,
@ -278,17 +286,20 @@ static hb_font_funcs_t* getFontFuncs()
hb_font_funcs_set_glyph_func (funcs, getFontGlyph, nullptr, nullptr);
hb_font_funcs_set_glyph_h_advance_func (funcs, getGlyphAdvanceH, nullptr, nullptr);
hb_font_funcs_set_glyph_h_kerning_func (funcs, getGlyphKerningH, nullptr, nullptr);
hb_font_funcs_set_glyph_extents_func (funcs, getGlyphExtents, nullptr, nullptr);
hb_font_funcs_set_glyph_contour_point_func (funcs, getGlyphContourPoint, nullptr, nullptr);
#if !HB_VERSION_ATLEAST(1, 1, 2)
hb_font_funcs_set_glyph_v_advance_func (funcs, getGlyphAdvanceV, nullptr, nullptr);
hb_font_funcs_set_glyph_h_origin_func (funcs, getGlyphOriginH, nullptr, nullptr);
hb_font_funcs_set_glyph_v_origin_func (funcs, getGlyphOriginV, nullptr, nullptr);
hb_font_funcs_set_glyph_h_kerning_func (funcs, getGlyphKerningH, nullptr, nullptr);
hb_font_funcs_set_glyph_v_kerning_func (funcs, getGlyphKerningV, nullptr, nullptr);
hb_font_funcs_set_glyph_extents_func (funcs, getGlyphExtents, nullptr, nullptr);
hb_font_funcs_set_glyph_contour_point_func (funcs, getGlyphContourPoint, nullptr, nullptr);
#endif
return funcs;
}
#if !HB_VERSION_ATLEAST(1, 1, 0)
// Disabled Unicode compatibility decomposition, see fdo#66715
static unsigned int unicodeDecomposeCompatibility(hb_unicode_funcs_t* /*ufuncs*/,
hb_codepoint_t /*u*/,
@ -304,6 +315,7 @@ static hb_unicode_funcs_t* getUnicodeFuncs()
hb_unicode_funcs_set_decompose_compatibility_func(ufuncs, unicodeDecomposeCompatibility, nullptr, nullptr);
return ufuncs;
}
#endif
class HbLayoutEngine : public ServerFontLayoutEngine
{
@ -470,9 +482,6 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
LanguageTag &rTag = rArgs.maLanguageTag;
OString sLanguage = OUStringToOString( MsLangId::isChinese(rTag.getLanguageType()) ? rTag.getBcp47():rTag.getLanguage() , RTL_TEXTENCODING_UTF8 );
static hb_unicode_funcs_t* pHbUnicodeFuncs = getUnicodeFuncs();
int nHbFlags = HB_BUFFER_FLAGS_DEFAULT;
if (nMinRunPos == 0)
nHbFlags |= HB_BUFFER_FLAG_BOT; /* Beginning-of-text */
@ -480,7 +489,10 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
nHbFlags |= HB_BUFFER_FLAG_EOT; /* End-of-text */
hb_buffer_t *pHbBuffer = hb_buffer_create();
#if !HB_VERSION_ATLEAST(1, 1, 0)
static hb_unicode_funcs_t* pHbUnicodeFuncs = getUnicodeFuncs();
hb_buffer_set_unicode_funcs(pHbBuffer, pHbUnicodeFuncs);
#endif
hb_buffer_set_direction(pHbBuffer, bRightToLeft ? HB_DIRECTION_RTL: HB_DIRECTION_LTR);
hb_buffer_set_script(pHbBuffer, maHbScript);
hb_buffer_set_language(pHbBuffer, hb_language_from_string(sLanguage.getStr(), -1));