summaryrefslogtreecommitdiffstats
path: root/sample/MinikinSkia.h
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2013-07-15 14:19:59 -0700
committerRaph Levien <raph@google.com>2014-05-12 09:08:15 -0700
commitecc2d34ac23a497988f21e5f415b53c007b9d8c5 (patch)
tree876b3c943b7841c9600db636738cd0e59b5f2a7c /sample/MinikinSkia.h
parent5adafc0d84d238948b5d257ec5311030ca04271c (diff)
downloadandroid_frameworks_minikin-ecc2d34ac23a497988f21e5f415b53c007b9d8c5.tar.gz
android_frameworks_minikin-ecc2d34ac23a497988f21e5f415b53c007b9d8c5.tar.bz2
android_frameworks_minikin-ecc2d34ac23a497988f21e5f415b53c007b9d8c5.zip
A basket of features: itemization, bounds, refcount
This patch improves script run itemization and also exposes metrics and bounds for layouts. In addition, there is a fair amount of internal cleanup, including ref counting, and making the MinikinFont abstraction strong enough to support both FreeType and Skia implementations. There is also a sample implementation using Skia, in the sample directory. As part of its functionality, his patch measures the bounds of the layout and gives access through Layout::GetBounds(). The corresponding method is not implemented in the FreeType-only implementation of MinikinFont, so that will probably have to be fixed. Change-Id: Ib1a3fe9d7c90519ac651fb4aa957848e4bb758ec
Diffstat (limited to 'sample/MinikinSkia.h')
-rw-r--r--sample/MinikinSkia.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/sample/MinikinSkia.h b/sample/MinikinSkia.h
new file mode 100644
index 0000000..8286a4c
--- /dev/null
+++ b/sample/MinikinSkia.h
@@ -0,0 +1,26 @@
+namespace android {
+
+class MinikinFontSkia : public MinikinFont {
+public:
+ explicit MinikinFontSkia(SkTypeface *typeface);
+
+ ~MinikinFontSkia();
+
+ bool GetGlyph(uint32_t codepoint, uint32_t *glyph) const;
+
+ float GetHorizontalAdvance(uint32_t glyph_id,
+ const MinikinPaint &paint) const;
+
+ // If buf is NULL, just update size
+ bool GetTable(uint32_t tag, uint8_t *buf, size_t *size);
+
+ int32_t GetUniqueId() const;
+
+ SkTypeface *GetSkTypeface();
+
+private:
+ SkTypeface *mTypeface;
+
+};
+
+} // namespace android \ No newline at end of file