summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-06-10 19:09:46 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-06-10 19:09:51 +0000
commit1c7b403ad8026fdebd0185319183d0a7a2c377bd (patch)
tree3d3f49ce126cab6eb900a4aacf29f197d9a81a4e
parent9a5f713add8cfb91ac2c9ed5c917309053201ab6 (diff)
parent4043f6f6d9c584bc61bc3d81d1680bf1b558330e (diff)
downloadandroid_frameworks_minikin-1c7b403ad8026fdebd0185319183d0a7a2c377bd.tar.gz
android_frameworks_minikin-1c7b403ad8026fdebd0185319183d0a7a2c377bd.tar.bz2
android_frameworks_minikin-1c7b403ad8026fdebd0185319183d0a7a2c377bd.zip
Merge "Provisionally enable "palt" OpenType feature"
-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 709393d..762a7db 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++) {
@@ -664,7 +673,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);