summaryrefslogtreecommitdiffstats
path: root/skia/sgl
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 00:44:49 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 00:44:49 +0000
commit83f6e08f4c56ef411ad1da5f3bfd4711ec94b052 (patch)
tree6bf8e871963cfc1ab8bf6190dceed5b9631cf8ee /skia/sgl
parentd5c0e0e416a67e7e8dd98745cdf1bdc7de20517c (diff)
downloadchromium_src-83f6e08f4c56ef411ad1da5f3bfd4711ec94b052.zip
chromium_src-83f6e08f4c56ef411ad1da5f3bfd4711ec94b052.tar.gz
chromium_src-83f6e08f4c56ef411ad1da5f3bfd4711ec94b052.tar.bz2
Add Harfbuzz to third_party and Skia support for such.
Harfbuzz is an open source library which is a unification of the Qt and Pango shaping engines. We'll be using it on Chromium Linux to perform complex text shaping. Additionally, we add support for Harfbuzz into Skia, guarded by SKIA_HARFBUZZ. http://codereview.chromium.org/63035/show git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13214 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/sgl')
-rw-r--r--skia/sgl/SkGlyphCache.cpp12
-rw-r--r--skia/sgl/SkGlyphCache.h11
-rw-r--r--skia/sgl/SkPaint.cpp12
3 files changed, 35 insertions, 0 deletions
diff --git a/skia/sgl/SkGlyphCache.cpp b/skia/sgl/SkGlyphCache.cpp
index 6b214df..9836c73 100644
--- a/skia/sgl/SkGlyphCache.cpp
+++ b/skia/sgl/SkGlyphCache.cpp
@@ -328,6 +328,18 @@ const SkPath* SkGlyphCache::findPath(const SkGlyph& glyph) {
///////////////////////////////////////////////////////////////////////////////
+#ifdef SKIA_HARFBUZZ
+void SkGlyphCache::setupShaper(HB_ShaperItem* item) {
+ fScalerContext->setupShaper(item);
+}
+
+void SkGlyphCache::releaseShaper(HB_ShaperItem* item) {
+ fScalerContext->releaseShaper(item);
+}
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+
bool SkGlyphCache::getAuxProcData(void (*proc)(void*), void** dataPtr) const {
const AuxProcRec* rec = fAuxProcList;
while (rec) {
diff --git a/skia/sgl/SkGlyphCache.h b/skia/sgl/SkGlyphCache.h
index 2462ea5..db9e8d5 100644
--- a/skia/sgl/SkGlyphCache.h
+++ b/skia/sgl/SkGlyphCache.h
@@ -27,6 +27,7 @@
class SkPaint;
class SkGlyphCache_Globals;
+typedef struct HB_ShaperItem_ HB_ShaperItem;
/** \class SkGlyphCache
@@ -86,6 +87,16 @@ public:
const SkPaint::FontMetrics& getFontMetricsY() const {
return fFontMetricsY;
}
+
+#ifdef SKIA_HARFBUZZ
+ /** Setup a Harfbuzz shaper item with the correct |font| and |face| members.
+ */
+ void setupShaper(HB_ShaperItem* item);
+ /** Release the given references associated with |item|.
+ */
+ void releaseShaper(HB_ShaperItem* item);
+#endif
+
/* AuxProc/Data allow a client to associate data with this cache entry.
Multiple clients can use this, as their data is keyed with a function
diff --git a/skia/sgl/SkPaint.cpp b/skia/sgl/SkPaint.cpp
index bb6b31e..5fc1f14 100644
--- a/skia/sgl/SkPaint.cpp
+++ b/skia/sgl/SkPaint.cpp
@@ -365,6 +365,18 @@ int SkPaint::textToGlyphs(const void* textData, size_t byteLength,
return gptr - glyphs;
}
+#ifdef SKIA_HARFBUZZ
+void SkPaint::setupShaper(HB_ShaperItem* item) {
+ SkAutoGlyphCache autoCache(*this, NULL);
+ autoCache.getCache()->setupShaper(item);
+}
+
+void SkPaint::releaseShaper(HB_ShaperItem* item) {
+ SkAutoGlyphCache autoCache(*this, NULL);
+ autoCache.getCache()->releaseShaper(item);
+}
+#endif
+
///////////////////////////////////////////////////////////////////////////////
static uint32_t sk_glyphID_next(const char** text)