From c3b80ba50a494efdf6505585dc32dbe7422d5555 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Fri, 1 Jun 2012 19:36:05 +0000 Subject: read/write sfnt-data length, to match convetion of other fonthosts. TODO: move that "convention" into shared code (SkTypeface.cpp or SkFontHost.cpp) and just require each port to support: 1. typeface <--> descriptor 2. typeface_raw_data <--> stream (possibly with algo-style flags) git-svn-id: http://skia.googlecode.com/svn/trunk@4125 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/ports/SkFontHost_mac_coretext.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ports/SkFontHost_mac_coretext.cpp b/src/ports/SkFontHost_mac_coretext.cpp index f49185fb34..118ef50edc 100644 --- a/src/ports/SkFontHost_mac_coretext.cpp +++ b/src/ports/SkFontHost_mac_coretext.cpp @@ -1858,11 +1858,20 @@ void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) { desc.setPostscriptName(get_str(CTFontCopyPostScriptName(ctFont), &tmpStr)); desc.serialize(stream); + + // by convention, we also write out the actual sfnt data, preceeded by + // a packed-length. For now we skip that, so we just write the zero. + stream->writePackedUInt(0); } SkTypeface* SkFontHost::Deserialize(SkStream* stream) { SkFontDescriptor desc(stream); + // by convention, Serialize will have also written the actual sfnt data. + // for now, we just want to skip it. + size_t size = stream->readPackedUInt(); + stream->skip(size); + return SkFontHost::CreateTypeface(NULL, desc.getFamilyName(), desc.getStyle()); } -- cgit v1.2.3