summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-06-07 08:14:07 -0700
committerRaph Levien <raph@google.com>2014-06-07 08:23:25 -0700
commit4043f6f6d9c584bc61bc3d81d1680bf1b558330e (patch)
tree4b06b53a5aa4b00f2faf4df25dc30dd336745316
parent89566f0ada1cafe673efa064cde38467990235d4 (diff)
downloadandroid_frameworks_minikin-4043f6f6d9c584bc61bc3d81d1680bf1b558330e.tar.gz
android_frameworks_minikin-4043f6f6d9c584bc61bc3d81d1680bf1b558330e.tar.bz2
android_frameworks_minikin-4043f6f6d9c584bc61bc3d81d1680bf1b558330e.zip
Provisionally enable "palt" OpenType feature
We want to test configurations where the Noto Japanese font will have its "palt" feature (to select tighter spacing in kana) will be enabled for framework but not WebView or Chrome rendering of Japanese text. This patch simply hardcodes this feature on. This is also a first step towards more general setting of OpenType features. The hardcoded feature list will grow into one set by parameters which will eventually be plumbed up to Java. Change-Id: Ie284e0487a1434155c8ac1cb68ddc4fc4b3c018a
-rw-r--r--libs/minikin/Layout.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/minikin/Layout.cpp b/libs/minikin/Layout.cpp
index 3cab673..2fdf853 100644
--- a/libs/minikin/Layout.cpp
+++ b/libs/minikin/Layout.cpp
@@ -618,6 +618,12 @@ void Layout::doLayoutWord(const uint16_t* buf, size_t start, size_t count, size_
cache.mCache.put(key, value);
}
+static void addFeatures(vector<hb_feature_t>* features) {
+ // hardcoded features, to be repaced with more flexible configuration
+ static hb_feature_t palt = { HB_TAG('p', 'a', 'l', 't'), 1, 0, ~0u };
+ features->push_back(palt);
+}
+
void Layout::doLayoutRun(const uint16_t* buf, size_t start, size_t count, size_t bufSize,
bool isRtl, LayoutContext* ctx) {
hb_buffer_t* buffer = LayoutEngine::getInstance().hbBuffer;
@@ -627,6 +633,9 @@ void Layout::doLayoutRun(const uint16_t* buf, size_t start, size_t count, size_t
std::reverse(items.begin(), items.end());
}
+ vector<hb_feature_t> features;
+ addFeatures(&features);
+
float x = mAdvance;
float y = 0;
for (size_t run_ix = 0; run_ix < items.size(); run_ix++) {
@@ -663,7 +672,7 @@ void Layout::doLayoutRun(const uint16_t* buf, size_t start, size_t count, size_t
hb_buffer_set_language(buffer, hb_language_from_string(lang.c_str(), -1));
}
hb_buffer_add_utf16(buffer, buf, bufSize, srunstart + start, srunend - srunstart);
- hb_shape(hbFont, buffer, NULL, 0);
+ hb_shape(hbFont, buffer, features.empty() ? NULL : &features[0], features.size());
unsigned int numGlyphs;
hb_glyph_info_t* info = hb_buffer_get_glyph_infos(buffer, &numGlyphs);
hb_glyph_position_t* positions = hb_buffer_get_glyph_positions(buffer, NULL);