Roll sfntly to r98
BUG=none TEST=none Review URL: http://codereview.chromium.org/8037029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102795 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
2
DEPS
2
DEPS
@ -28,7 +28,7 @@ vars = {
|
||||
"libjingle_revision": "85",
|
||||
"libvpx_revision": "97420",
|
||||
"ffmpeg_revision": "99115",
|
||||
"sfntly_revision": "54",
|
||||
"sfntly_revision": "98",
|
||||
"skia_revision": "2315",
|
||||
"v8_revision": "9288",
|
||||
"webrtc_revision": "634",
|
||||
|
82
third_party/sfntly/sfntly.gyp
vendored
82
third_party/sfntly/sfntly.gyp
vendored
@ -8,8 +8,6 @@
|
||||
'target_name': 'sfntly',
|
||||
'type': 'static_library',
|
||||
'sources': [
|
||||
'src/sfntly/cmap_table.cc',
|
||||
'src/sfntly/cmap_table.h',
|
||||
'src/sfntly/data/byte_array.cc',
|
||||
'src/sfntly/data/byte_array.h',
|
||||
'src/sfntly/data/font_data.cc',
|
||||
@ -28,29 +26,10 @@
|
||||
'src/sfntly/data/writable_font_data.h',
|
||||
'src/sfntly/font.cc',
|
||||
'src/sfntly/font.h',
|
||||
'src/sfntly/font_data_table.cc',
|
||||
'src/sfntly/font_data_table.h',
|
||||
'src/sfntly/font_data_table_builder_container.h',
|
||||
'src/sfntly/font_factory.cc',
|
||||
'src/sfntly/font_factory.h',
|
||||
'src/sfntly/font_header_table.cc',
|
||||
'src/sfntly/font_header_table.h',
|
||||
'src/sfntly/glyph_table.cc',
|
||||
'src/sfntly/glyph_table.h',
|
||||
'src/sfntly/horizontal_header_table.cc',
|
||||
'src/sfntly/horizontal_header_table.h',
|
||||
'src/sfntly/horizontal_metrics_table.cc',
|
||||
'src/sfntly/horizontal_metrics_table.h',
|
||||
'src/sfntly/loca_table.cc',
|
||||
'src/sfntly/loca_table.h',
|
||||
'src/sfntly/math/fixed1616.h',
|
||||
'src/sfntly/math/font_math.h',
|
||||
'src/sfntly/maximum_profile_table.cc',
|
||||
'src/sfntly/maximum_profile_table.h',
|
||||
'src/sfntly/name_table.cc',
|
||||
'src/sfntly/name_table.h',
|
||||
'src/sfntly/os2_table.cc',
|
||||
'src/sfntly/os2_table.h',
|
||||
'src/sfntly/port/atomic.h',
|
||||
'src/sfntly/port/config.h',
|
||||
'src/sfntly/port/endian.h',
|
||||
@ -58,15 +37,68 @@
|
||||
'src/sfntly/port/file_input_stream.cc',
|
||||
'src/sfntly/port/file_input_stream.h',
|
||||
'src/sfntly/port/input_stream.h',
|
||||
'src/sfntly/port/lock.cc',
|
||||
'src/sfntly/port/lock.h',
|
||||
'src/sfntly/port/memory_input_stream.cc',
|
||||
'src/sfntly/port/memory_input_stream.h',
|
||||
'src/sfntly/port/memory_output_stream.cc',
|
||||
'src/sfntly/port/memory_output_stream.h',
|
||||
'src/sfntly/port/output_stream.h',
|
||||
'src/sfntly/port/refcount.h',
|
||||
'src/sfntly/port/type.h',
|
||||
'src/sfntly/subtable.cc',
|
||||
'src/sfntly/subtable.h',
|
||||
'src/sfntly/table.cc',
|
||||
'src/sfntly/table.h',
|
||||
'src/sfntly/table/bitmap/bitmap_glyph.cc',
|
||||
'src/sfntly/table/bitmap/bitmap_glyph.h',
|
||||
'src/sfntly/table/bitmap/bitmap_size_table.cc',
|
||||
'src/sfntly/table/bitmap/bitmap_size_table.h',
|
||||
'src/sfntly/table/bitmap/composite_bitmap_glyph.cc',
|
||||
'src/sfntly/table/bitmap/composite_bitmap_glyph.h',
|
||||
'src/sfntly/table/bitmap/ebdt_table.cc',
|
||||
'src/sfntly/table/bitmap/ebdt_table.h',
|
||||
'src/sfntly/table/bitmap/eblc_table.cc',
|
||||
'src/sfntly/table/bitmap/eblc_table.h',
|
||||
'src/sfntly/table/bitmap/index_sub_table.cc',
|
||||
'src/sfntly/table/bitmap/index_sub_table.h',
|
||||
'src/sfntly/table/bitmap/index_sub_table_format1.cc',
|
||||
'src/sfntly/table/bitmap/index_sub_table_format1.h',
|
||||
'src/sfntly/table/bitmap/index_sub_table_format2.cc',
|
||||
'src/sfntly/table/bitmap/index_sub_table_format2.h',
|
||||
'src/sfntly/table/bitmap/index_sub_table_format3.cc',
|
||||
'src/sfntly/table/bitmap/index_sub_table_format3.h',
|
||||
'src/sfntly/table/bitmap/index_sub_table_format4.cc',
|
||||
'src/sfntly/table/bitmap/index_sub_table_format4.h',
|
||||
'src/sfntly/table/bitmap/index_sub_table_format5.cc',
|
||||
'src/sfntly/table/bitmap/index_sub_table_format5.h',
|
||||
'src/sfntly/table/bitmap/simple_bitmap_glyph.cc',
|
||||
'src/sfntly/table/bitmap/simple_bitmap_glyph.h',
|
||||
'src/sfntly/table/core/cmap_table.cc',
|
||||
'src/sfntly/table/core/cmap_table.h',
|
||||
'src/sfntly/table/core/font_header_table.cc',
|
||||
'src/sfntly/table/core/font_header_table.h',
|
||||
'src/sfntly/table/core/horizontal_header_table.cc',
|
||||
'src/sfntly/table/core/horizontal_header_table.h',
|
||||
'src/sfntly/table/core/horizontal_metrics_table.cc',
|
||||
'src/sfntly/table/core/horizontal_metrics_table.h',
|
||||
'src/sfntly/table/core/maximum_profile_table.cc',
|
||||
'src/sfntly/table/core/maximum_profile_table.h',
|
||||
'src/sfntly/table/core/name_table.cc',
|
||||
'src/sfntly/table/core/name_table.h',
|
||||
'src/sfntly/table/core/os2_table.cc',
|
||||
'src/sfntly/table/core/os2_table.h',
|
||||
'src/sfntly/table/font_data_table.cc',
|
||||
'src/sfntly/table/font_data_table.h',
|
||||
'src/sfntly/table/header.cc',
|
||||
'src/sfntly/table/header.h',
|
||||
'src/sfntly/table/subtable.cc',
|
||||
'src/sfntly/table/subtable.h',
|
||||
'src/sfntly/table/subtable_container_table.h',
|
||||
'src/sfntly/table/table.cc',
|
||||
'src/sfntly/table/table.h',
|
||||
'src/sfntly/table/table_based_table_builder.cc',
|
||||
'src/sfntly/table/table_based_table_builder.h',
|
||||
'src/sfntly/table/truetype/glyph_table.cc',
|
||||
'src/sfntly/table/truetype/glyph_table.h',
|
||||
'src/sfntly/table/truetype/loca_table.cc',
|
||||
'src/sfntly/table/truetype/loca_table.h',
|
||||
'src/sfntly/tag.cc',
|
||||
'src/sfntly/tag.h',
|
||||
'src/subsetter/font_subsetter.cc',
|
||||
|
@ -21,11 +21,12 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include "third_party/sfntly/src/sfntly/glyph_table.h"
|
||||
#include "third_party/sfntly/src/sfntly/loca_table.h"
|
||||
#include "third_party/sfntly/src/sfntly/name_table.h"
|
||||
#include "third_party/sfntly/src/sfntly/table/core/name_table.h"
|
||||
#include "third_party/sfntly/src/sfntly/table/truetype/glyph_table.h"
|
||||
#include "third_party/sfntly/src/sfntly/table/truetype/loca_table.h"
|
||||
#include "third_party/sfntly/src/sfntly/tag.h"
|
||||
#include "third_party/sfntly/src/sfntly/data/memory_byte_array.h"
|
||||
#include "third_party/sfntly/src/sfntly/port/memory_input_stream.h"
|
||||
#include "third_party/sfntly/src/sfntly/port/memory_output_stream.h"
|
||||
|
||||
namespace sfntly {
|
||||
@ -79,14 +80,14 @@ SubsetterImpl::~SubsetterImpl() {
|
||||
bool SubsetterImpl::LoadFont(const char* font_name,
|
||||
const unsigned char* original_font,
|
||||
size_t font_size) {
|
||||
ByteArrayPtr raw_font =
|
||||
new MemoryByteArray((byte_t*)original_font, font_size);
|
||||
MemoryInputStream mis;
|
||||
mis.Attach(original_font, font_size);
|
||||
if (factory_ == NULL) {
|
||||
factory_.Attach(FontFactory::GetInstance());
|
||||
}
|
||||
|
||||
FontArray font_array;
|
||||
factory_->LoadFonts(raw_font, &font_array);
|
||||
factory_->LoadFonts(&mis, &font_array);
|
||||
font_ = FindFont(font_name, font_array);
|
||||
if (font_ == NULL) {
|
||||
return false;
|
||||
@ -221,7 +222,7 @@ bool SubsetterImpl::ResolveCompositeGlyphs(const unsigned int* glyph_ids,
|
||||
IntegerSet comp_glyph_id;
|
||||
for (IntegerSet::iterator i = glyph_id_remaining.begin(),
|
||||
e = glyph_id_remaining.end(); i != e; ++i) {
|
||||
if (*i < 0 || *i >= loca_table->NumGlyphs()) {
|
||||
if (*i < 0 || *i >= loca_table->num_glyphs()) {
|
||||
// Invalid glyph id, ignore.
|
||||
continue;
|
||||
}
|
||||
@ -272,12 +273,10 @@ CALLER_ATTACH Font* SubsetterImpl::Subset(const IntegerSet& glyph_ids) {
|
||||
FontBuilderPtr font_builder;
|
||||
font_builder.Attach(factory_->NewFontBuilder());
|
||||
|
||||
GlyphTableBuilderPtr glyph_table_builder;
|
||||
glyph_table_builder.Attach(down_cast<GlyphTable::Builder*>(
|
||||
font_builder->NewTableBuilder(Tag::glyf)));
|
||||
LocaTableBuilderPtr loca_table_builder;
|
||||
loca_table_builder.Attach(down_cast<LocaTable::Builder*>(
|
||||
font_builder->NewTableBuilder(Tag::loca)));
|
||||
GlyphTableBuilderPtr glyph_table_builder =
|
||||
down_cast<GlyphTable::Builder*>(font_builder->NewTableBuilder(Tag::glyf));
|
||||
LocaTableBuilderPtr loca_table_builder =
|
||||
down_cast<LocaTable::Builder*>(font_builder->NewTableBuilder(Tag::loca));
|
||||
if (glyph_table_builder == NULL || loca_table_builder == NULL) {
|
||||
// Out of memory.
|
||||
return NULL;
|
||||
@ -285,7 +284,7 @@ CALLER_ATTACH Font* SubsetterImpl::Subset(const IntegerSet& glyph_ids) {
|
||||
|
||||
// Extract glyphs and setup loca list.
|
||||
IntegerList loca_list;
|
||||
loca_list.resize(loca_table->NumGlyphs());
|
||||
loca_list.resize(loca_table->num_glyphs());
|
||||
loca_list.push_back(0);
|
||||
int32_t last_glyph_id = 0;
|
||||
int32_t last_offset = 0;
|
||||
@ -302,7 +301,7 @@ CALLER_ATTACH Font* SubsetterImpl::Subset(const IntegerSet& glyph_ids) {
|
||||
// Add glyph to new glyf table.
|
||||
ReadableFontDataPtr data = glyph->ReadFontData();
|
||||
WritableFontDataPtr copy_data;
|
||||
copy_data.Attach(font_builder->GetNewData(data->Length()));
|
||||
copy_data.Attach(WritableFontData::CreateWritableFontData(data->Length()));
|
||||
data->CopyTo(copy_data);
|
||||
GlyphBuilderPtr glyph_builder;
|
||||
glyph_builder.Attach(glyph_table_builder->GlyphBuilder(copy_data));
|
||||
@ -316,22 +315,17 @@ CALLER_ATTACH Font* SubsetterImpl::Subset(const IntegerSet& glyph_ids) {
|
||||
loca_list[*i + 1] = last_offset;
|
||||
last_glyph_id = *i;
|
||||
}
|
||||
for (int32_t j = last_glyph_id + 1; j <= loca_table->NumGlyphs(); ++j) {
|
||||
for (int32_t j = last_glyph_id + 1; j <= loca_table->num_glyphs(); ++j) {
|
||||
loca_list[j] = last_offset;
|
||||
}
|
||||
loca_table_builder->SetLocaList(&loca_list);
|
||||
|
||||
// Setup remaining builders.
|
||||
for (TableMap::iterator i = font_->Tables()->begin(),
|
||||
e = font_->Tables()->end(); i != e; ++i) {
|
||||
for (TableMap::const_iterator i = font_->GetTableMap()->begin(),
|
||||
e = font_->GetTableMap()->end(); i != e; ++i) {
|
||||
// We already build the builder for glyph and loca.
|
||||
if (i->first != Tag::glyf && i->first != Tag::loca) {
|
||||
// The newTableBuilder() call will alter internal state of font_builder
|
||||
// AND the reference count of returned object. Therefore we need to
|
||||
// dereference it.
|
||||
TableBuilderPtr dereference;
|
||||
dereference.Attach(
|
||||
font_builder->NewTableBuilder(i->first, i->second->ReadFontData()));
|
||||
font_builder->NewTableBuilder(i->first, i->second->ReadFontData());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user