Diff
Modified: trunk/Source/WebCore/ChangeLog (144975 => 144976)
--- trunk/Source/WebCore/ChangeLog 2013-03-06 21:35:22 UTC (rev 144975)
+++ trunk/Source/WebCore/ChangeLog 2013-03-06 21:38:19 UTC (rev 144976)
@@ -1,3 +1,24 @@
+2013-03-06 Mike Reed <r...@google.com>
+
+ Use SkTypeface API directly, rather than (soon to be private) SkFontHost
+ https://bugs.webkit.org/show_bug.cgi?id=111588
+
+ Reviewed by Stephen White.
+
+ No new tests, as existing tests in fast/writing-mode exercise this code.
+
+ e.g. japanese-rl-text-with-broken-font.html
+ vertical-subst-font-vert-no-dflt.html
+
+ * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp:
+ (WebCore::FontPlatformData::emSizeInFontUnits):
+ (WebCore::FontPlatformData::openTypeTable):
+ * platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp:
+ (WebCore::harfBuzzSkiaGetTable):
+ (WebCore::HarfBuzzFace::createFace):
+ * platform/graphics/skia/SimpleFontDataSkia.cpp:
+ (WebCore::SimpleFontData::platformInit):
+
2013-03-06 Victor Costan <cos...@gmail.com>
Cleanup in multipart FormData sending code.
Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp (144975 => 144976)
--- trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp 2013-03-06 21:35:22 UTC (rev 144975)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp 2013-03-06 21:38:19 UTC (rev 144976)
@@ -35,7 +35,6 @@
#include "HarfBuzzFace.h"
#include "NotImplemented.h"
#include "SkAdvancedTypefaceMetrics.h"
-#include "SkFontHost.h"
#include "SkPaint.h"
#include "SkTypeface.h"
@@ -171,7 +170,7 @@
#if OS(ANDROID)
// Android doesn't currently support Skia's getAdvancedTypefaceMetrics(),
// but it has access to another method to replace this functionality.
- m_emSizeInFontUnits = SkFontHost::GetUnitsPerEm(m_typeface->uniqueID());
+ m_emSizeInFontUnits = m_typeface->getUnitsPerEm();
#else
SkAdvancedTypefaceMetrics* metrics = m_typeface->getAdvancedTypefaceMetrics(SkAdvancedTypefaceMetrics::kNo_PerGlyphInfo);
m_emSizeInFontUnits = metrics->fEmSize;
@@ -335,10 +334,10 @@
RefPtr<SharedBuffer> buffer;
SkFontTableTag tag = reverseByteOrder(table);
- const size_t tableSize = SkFontHost::GetTableSize(uniqueID(), tag);
+ const size_t tableSize = m_typeface->getTableSize(tag);
if (tableSize) {
Vector<char> tableBuffer(tableSize);
- SkFontHost::GetTableData(uniqueID(), tag, 0, tableSize, &tableBuffer[0]);
+ m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]);
buffer = SharedBuffer::adoptVector(tableBuffer);
}
return buffer.release();
Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h (144975 => 144976)
--- trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h 2013-03-06 21:35:22 UTC (rev 144975)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h 2013-03-06 21:38:19 UTC (rev 144976)
@@ -85,6 +85,7 @@
// the font's file name so refers to a single face.
// -------------------------------------------------------------------------
SkFontID uniqueID() const;
+ SkTypeface* typeface() const { return m_typeface; }
unsigned hash() const;
float size() const { return m_textSize; }
Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp (144975 => 144976)
--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp 2013-03-06 21:35:22 UTC (rev 144975)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp 2013-03-06 21:38:19 UTC (rev 144976)
@@ -35,11 +35,11 @@
#include "GlyphBuffer.h"
#include "HarfBuzzShaper.h"
#include "SimpleFontData.h"
-#include "SkFontHost.h"
#include "SkPaint.h"
#include "SkPath.h"
#include "SkPoint.h"
#include "SkRect.h"
+#include "SkTypeface.h"
#include "SkUtils.h"
#include "hb.h"
@@ -144,16 +144,16 @@
static hb_blob_t* harfBuzzSkiaGetTable(hb_face_t* face, hb_tag_t tag, void* userData)
{
- SkFontID uniqueID = static_cast<SkFontID>(reinterpret_cast<uint64_t>(userData));
+ SkTypeface* typeface = reinterpret_cast<SkTypeface*>(userData);
- const size_t tableSize = SkFontHost::GetTableSize(uniqueID, tag);
+ const size_t tableSize = typeface->getTableSize(tag);
if (!tableSize)
return 0;
char* buffer = reinterpret_cast<char*>(fastMalloc(tableSize));
if (!buffer)
return 0;
- size_t actualSize = SkFontHost::GetTableData(uniqueID, tag, 0, tableSize, buffer);
+ size_t actualSize = typeface->getTableData(tag, 0, tableSize, buffer);
if (tableSize != actualSize) {
fastFree(buffer);
return 0;
@@ -170,7 +170,7 @@
hb_face_t* HarfBuzzFace::createFace()
{
- hb_face_t* face = hb_face_create_for_tables(harfBuzzSkiaGetTable, reinterpret_cast<void*>(m_platformData->uniqueID()), 0);
+ hb_face_t* face = hb_face_create_for_tables(harfBuzzSkiaGetTable, m_platformData->typeface(), 0);
ASSERT(face);
return face;
}
Modified: trunk/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp (144975 => 144976)
--- trunk/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp 2013-03-06 21:35:22 UTC (rev 144975)
+++ trunk/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp 2013-03-06 21:38:19 UTC (rev 144976)
@@ -36,7 +36,6 @@
#include "FontCache.h"
#include "FontDescription.h"
#include "Logging.h"
-#include "SkFontHost.h"
#include "SkPaint.h"
#include "SkTime.h"
#include "SkTypeface.h"
@@ -64,18 +63,18 @@
m_platformData.setupPaint(&paint);
paint.getFontMetrics(&metrics);
- const SkFontID fontID = m_platformData.uniqueID();
+ SkTypeface* face = paint.getTypeface();
static const uint32_t vdmxTag = SkSetFourByteTag('V', 'D', 'M', 'X');
int pixelSize = m_platformData.size() + 0.5;
int vdmxAscent, vdmxDescent;
bool isVDMXValid = false;
- size_t vdmxSize = SkFontHost::GetTableSize(fontID, vdmxTag);
+ size_t vdmxSize = face->getTableSize(vdmxTag);
if (vdmxSize && vdmxSize < maxVDMXTableSize) {
uint8_t* vdmxTable = (uint8_t*) fastMalloc(vdmxSize);
if (vdmxTable
- && SkFontHost::GetTableData(fontID, vdmxTag, 0, vdmxSize, vdmxTable) == vdmxSize
+ && face->getTableData(vdmxTag, 0, vdmxSize, vdmxTable) == vdmxSize
&& parseVDMX(&vdmxAscent, &vdmxDescent, vdmxTable, vdmxSize, pixelSize))
isVDMXValid = true;
fastFree(vdmxTable);
@@ -126,8 +125,8 @@
if (platformData().orientation() == Vertical && !isTextOrientationFallback()) {
static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a');
static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G');
- size_t vheaSize = SkFontHost::GetTableSize(fontID, vheaTag);
- size_t vorgSize = SkFontHost::GetTableSize(fontID, vorgTag);
+ size_t vheaSize = face->getTableSize(vheaTag);
+ size_t vorgSize = face->getTableSize(vorgTag);
if ((vheaSize > 0) || (vorgSize > 0))
m_hasVerticalGlyphs = true;
}
@@ -161,7 +160,7 @@
}
}
- if (int unitsPerEm = paint.getTypeface()->getUnitsPerEm())
+ if (int unitsPerEm = face->getUnitsPerEm())
m_fontMetrics.setUnitsPerEm(unitsPerEm);
}