summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2010-12-14 17:18:35 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2010-12-20 12:47:10 (GMT)
commitad0841dfd89d08140b719098ecfec82881df63e6 (patch)
treed78c8d616a3ff9fb01102ec147d899314594850a /src
parent0189fc2335c891373ce595a4a01e4a9d73cc5fe4 (diff)
downloadQt-ad0841dfd89d08140b719098ecfec82881df63e6.zip
Qt-ad0841dfd89d08140b719098ecfec82881df63e6.tar.gz
Qt-ad0841dfd89d08140b719098ecfec82881df63e6.tar.bz2
Disable certain GPOS features by default
According to OpenType Layout tag registry, these features should be turned off by default. Leaving them on will cause some text layout problems in common UI widgets -- they are usually designed for better positioning in print publishing or full featured text layout programs, not for general usage. There is no way to turn them on in HarfBuzz now, it should be addressed later. Features like 'valt' are intended for vertical writing mode are also turned off, since HarfBuzz doesn't support it properly yet. Task-number: QTBUG-15754 Reviewed-by: Lars Knoll
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
index ce4d4ac..ef86144 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
@@ -538,8 +538,20 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item)
#ifndef NO_OPENTYPE
static const HB_OpenTypeFeature basic_features[] = {
{ HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty },
- { HB_MAKE_TAG('l', 'i', 'g', 'a'), CcmpProperty },
- { HB_MAKE_TAG('c', 'l', 'i', 'g'), CcmpProperty },
+ { HB_MAKE_TAG('l', 'i', 'g', 'a'), LigaProperty },
+ { HB_MAKE_TAG('c', 'l', 'i', 'g'), CligProperty },
+ {0, 0}
+};
+
+static const HB_OpenTypeFeature disabled_features[] = {
+ { HB_MAKE_TAG('c', 'p', 'c', 't'), PositioningProperties },
+ { HB_MAKE_TAG('h', 'a', 'l', 't'), PositioningProperties },
+ // TODO: we need to add certain HB_ShaperFlag for vertical
+ // writing mode to enable these vertical writing features:
+ { HB_MAKE_TAG('v', 'a', 'l', 't'), PositioningProperties },
+ { HB_MAKE_TAG('v', 'h', 'a', 'l'), PositioningProperties },
+ { HB_MAKE_TAG('v', 'k', 'r', 'n'), PositioningProperties },
+ { HB_MAKE_TAG('v', 'p', 'a', 'l'), PositioningProperties },
{0, 0}
};
#endif
@@ -1110,12 +1122,29 @@ HB_Bool HB_SelectScript(HB_ShaperItem *shaper_item, const HB_OpenTypeFeature *fe
HB_UInt *feature_tag_list = feature_tag_list_buffer;
while (*feature_tag_list) {
HB_UShort feature_index;
+ bool skip = false;
if (*feature_tag_list == HB_MAKE_TAG('k', 'e', 'r', 'n')) {
- if (face->current_flags & HB_ShaperFlag_NoKerning) {
- ++feature_tag_list;
- continue;
+ if (face->current_flags & HB_ShaperFlag_NoKerning)
+ skip = true;
+ else
+ face->has_opentype_kerning = true;
+ }
+ features = disabled_features;
+ while (features->tag) {
+ if (*feature_tag_list == features->tag) {
+ skip = true;
+ break;
}
- face->has_opentype_kerning = true;
+ ++features;
+ }
+ // 'palt' should be turned off by default unless 'kern' is on
+ if (!face->has_opentype_kerning &&
+ *feature_tag_list == HB_MAKE_TAG('p', 'a', 'l', 't'))
+ skip = true;
+
+ if (skip) {
+ ++feature_tag_list;
+ continue;
}
error = HB_GPOS_Select_Feature(face->gpos, *feature_tag_list, script_index, 0xffff, &feature_index);
if (!error)