summaryrefslogtreecommitdiff
path: root/sfntly/table/bitmap
diff options
context:
space:
mode:
Diffstat (limited to 'sfntly/table/bitmap')
-rw-r--r--sfntly/table/bitmap/bitmap_size_table.cc4
-rw-r--r--sfntly/table/bitmap/ebdt_table.cc3
-rw-r--r--sfntly/table/bitmap/ebdt_table.h31
-rw-r--r--sfntly/table/bitmap/eblc_table.cc1
-rw-r--r--sfntly/table/bitmap/eblc_table.h1
-rw-r--r--sfntly/table/bitmap/ebsc_table.h5
-rw-r--r--sfntly/table/bitmap/index_sub_table_format1.cc8
-rw-r--r--sfntly/table/bitmap/index_sub_table_format1.h3
-rw-r--r--sfntly/table/bitmap/index_sub_table_format2.cc4
-rw-r--r--sfntly/table/bitmap/index_sub_table_format2.h2
-rw-r--r--sfntly/table/bitmap/index_sub_table_format3.cc8
-rw-r--r--sfntly/table/bitmap/index_sub_table_format3.h2
-rw-r--r--sfntly/table/bitmap/index_sub_table_format4.cc8
-rw-r--r--sfntly/table/bitmap/index_sub_table_format4.h9
-rw-r--r--sfntly/table/bitmap/index_sub_table_format5.cc9
-rw-r--r--sfntly/table/bitmap/index_sub_table_format5.h2
16 files changed, 54 insertions, 46 deletions
diff --git a/sfntly/table/bitmap/bitmap_size_table.cc b/sfntly/table/bitmap/bitmap_size_table.cc
index 93b8625..5e0c237 100644
--- a/sfntly/table/bitmap/bitmap_size_table.cc
+++ b/sfntly/table/bitmap/bitmap_size_table.cc
@@ -418,9 +418,9 @@ void BitmapSizeTable::Builder::Initialize(ReadableFontData* data) {
if (data) {
int32_t number_of_index_subtables =
BitmapSizeTable::NumberOfIndexSubTables(data, 0);
+ index_sub_tables_.resize(number_of_index_subtables);
for (int32_t i = 0; i < number_of_index_subtables; ++i) {
- index_sub_tables_[index_sub_tables_.size()].Attach(
- CreateIndexSubTableBuilder(i));
+ index_sub_tables_[i].Attach(CreateIndexSubTableBuilder(i));
}
}
}
diff --git a/sfntly/table/bitmap/ebdt_table.cc b/sfntly/table/bitmap/ebdt_table.cc
index 75a5080..19e5e55 100644
--- a/sfntly/table/bitmap/ebdt_table.cc
+++ b/sfntly/table/bitmap/ebdt_table.cc
@@ -118,6 +118,7 @@ int32_t EbdtTable::Builder::SubSerialize(WritableFontData* new_data) {
void EbdtTable::Builder::SetLoca(BitmapLocaList* loca_list) {
assert(loca_list);
Revert();
+ glyph_loca_.resize(loca_list->size());
std::copy(loca_list->begin(), loca_list->end(), glyph_loca_.begin());
}
@@ -131,7 +132,6 @@ void EbdtTable::Builder::GenerateLocaList(BitmapLocaList* output) {
}
}
- output->resize(glyph_builders_.size());
int start_offset = Offset::kHeaderLength;
for (BitmapGlyphBuilderList::iterator builder_map = glyph_builders_.begin(),
builder_end = glyph_builders_.end();
@@ -211,7 +211,6 @@ void EbdtTable::Builder::Initialize(ReadableFontData* data,
assert(output);
output->clear();
- output->resize(loca_list->size());
if (data) {
for (BitmapLocaList::iterator loca_map = loca_list->begin(),
loca_end = loca_list->end();
diff --git a/sfntly/table/bitmap/ebdt_table.h b/sfntly/table/bitmap/ebdt_table.h
index 723c3f9..79852c3 100644
--- a/sfntly/table/bitmap/ebdt_table.h
+++ b/sfntly/table/bitmap/ebdt_table.h
@@ -43,24 +43,24 @@ class EbdtTable : public SubTableContainerTable,
void SetLoca(BitmapLocaList* loca_list);
void GenerateLocaList(BitmapLocaList* output);
-
- // Gets the List of glyph builders for the glyph table builder. These may be
- // manipulated in any way by the caller and the changes will be reflected in
- // the final glyph table produced.
- // If there is no current data for the glyph builder or the glyph builders
- // have not been previously set then this will return an empty glyph builder
- // List. If there is current data (i.e. data read from an existing font) and
- // the loca list has not been set or is null, empty, or invalid, then an
- // empty glyph builder List will be returned.
+
+ // Gets the List of glyph builders for the glyph table builder. These may be
+ // manipulated in any way by the caller and the changes will be reflected in
+ // the final glyph table produced.
+ // If there is no current data for the glyph builder or the glyph builders
+ // have not been previously set then this will return an empty glyph builder
+ // List. If there is current data (i.e. data read from an existing font) and
+ // the loca list has not been set or is null, empty, or invalid, then an
+ // empty glyph builder List will be returned.
// @return the list of glyph builders
BitmapGlyphBuilderList* GlyphBuilders();
- // Replace the internal glyph builders with the one provided. The provided
- // list and all contained objects belong to this builder.
- // This call is only required if the entire set of glyphs in the glyph
- // table builder are being replaced. If the glyph builder list provided from
- // the {@link EbdtTable.Builder#glyphBuilders()} is being used and modified
- // then those changes will already be reflected in the glyph table builder.
+ // Replace the internal glyph builders with the one provided. The provided
+ // list and all contained objects belong to this builder.
+ // This call is only required if the entire set of glyphs in the glyph
+ // table builder are being replaced. If the glyph builder list provided from
+ // the {@link EbdtTable.Builder#glyphBuilders()} is being used and modified
+ // then those changes will already be reflected in the glyph table builder.
// @param glyphBuilders the new glyph builders
void SetGlyphBuilders(BitmapGlyphBuilderList* glyph_builders);
@@ -102,6 +102,7 @@ class EbdtTable : public SubTableContainerTable,
EbdtTable(Header* header, ReadableFontData* data);
};
typedef Ptr<EbdtTable> EbdtTablePtr;
+typedef Ptr<EbdtTable::Builder> EbdtTableBuilderPtr;
} // namespace sfntly
diff --git a/sfntly/table/bitmap/eblc_table.cc b/sfntly/table/bitmap/eblc_table.cc
index bb36db0..6691b04 100644
--- a/sfntly/table/bitmap/eblc_table.cc
+++ b/sfntly/table/bitmap/eblc_table.cc
@@ -238,7 +238,6 @@ void EblcTable::Builder::GenerateLocaList(BitmapLocaList* output) {
assert(output);
BitmapSizeTableBuilderList* size_builder_list = GetSizeList();
output->clear();
- output->resize(size_builder_list->size());
#if defined (SFNTLY_DEBUG_BITMAP)
int32_t size_index = 0;
#endif
diff --git a/sfntly/table/bitmap/eblc_table.h b/sfntly/table/bitmap/eblc_table.h
index f8f052d..3a9b4c4 100644
--- a/sfntly/table/bitmap/eblc_table.h
+++ b/sfntly/table/bitmap/eblc_table.h
@@ -180,6 +180,7 @@ class EblcTable : public SubTableContainerTable,
BitmapSizeTableList bitmap_size_table_;
};
typedef Ptr<EblcTable> EblcTablePtr;
+typedef Ptr<EblcTable::Builder> EblcTableBuilderPtr;
}
#endif // SFNTLY_CPP_SRC_SFNTLY_TABLE_BITMAP_EBLC_TABLE_H_
diff --git a/sfntly/table/bitmap/ebsc_table.h b/sfntly/table/bitmap/ebsc_table.h
index 43088fd..b79df38 100644
--- a/sfntly/table/bitmap/ebsc_table.h
+++ b/sfntly/table/bitmap/ebsc_table.h
@@ -61,9 +61,8 @@ class EbscTable : public Table,
explicit BitmapScaleTable(ReadableFontData* data);
};
- // TODO(stuartg): currently the builder is minimally functional
- // -just builds from initial data
- // - need to make fully working
+ // TODO(stuartg): currently the builder just builds from initial data
+ // - need to make fully working but few if any examples to test with
class Builder : public Table::Builder,
public RefCounted<Builder> {
public:
diff --git a/sfntly/table/bitmap/index_sub_table_format1.cc b/sfntly/table/bitmap/index_sub_table_format1.cc
index 809412d..634fbb0 100644
--- a/sfntly/table/bitmap/index_sub_table_format1.cc
+++ b/sfntly/table/bitmap/index_sub_table_format1.cc
@@ -94,8 +94,8 @@ int32_t IndexSubTableFormat1::Builder::GlyphStartOffset(int32_t glyph_id) {
return GetOffsetArray()->at(loca);
}
-CALLER_ATTACH
-BitmapGlyphInfoIter* IndexSubTableFormat1::Builder::GetIterator() {
+CALLER_ATTACH IndexSubTableFormat1::Builder::BitmapGlyphInfoIterator*
+ IndexSubTableFormat1::Builder::GetIterator() {
Ptr<IndexSubTableFormat1::Builder::BitmapGlyphInfoIterator> it =
new IndexSubTableFormat1::Builder::BitmapGlyphInfoIterator(this);
return it.Detach();
@@ -188,6 +188,10 @@ int32_t IndexSubTableFormat1::Builder::SubSerialize(
return size;
}
+IntegerList* IndexSubTableFormat1::Builder::OffsetArray() {
+ return GetOffsetArray();
+}
+
void IndexSubTableFormat1::Builder::SetOffsetArray(
const IntegerList& offset_array) {
offset_array_.clear();
diff --git a/sfntly/table/bitmap/index_sub_table_format1.h b/sfntly/table/bitmap/index_sub_table_format1.h
index c36bf18..1078831 100644
--- a/sfntly/table/bitmap/index_sub_table_format1.h
+++ b/sfntly/table/bitmap/index_sub_table_format1.h
@@ -45,7 +45,7 @@ class IndexSubTableFormat1 : public IndexSubTable,
virtual int32_t NumGlyphs();
virtual int32_t GlyphLength(int32_t glyph_id);
virtual int32_t GlyphStartOffset(int32_t glyph_id);
- CALLER_ATTACH virtual BitmapGlyphInfoIter* GetIterator();
+ CALLER_ATTACH virtual BitmapGlyphInfoIterator* GetIterator();
virtual CALLER_ATTACH FontDataTable* SubBuildTable(ReadableFontData* data);
virtual void SubDataSet();
@@ -53,6 +53,7 @@ class IndexSubTableFormat1 : public IndexSubTable,
virtual bool SubReadyToSerialize();
virtual int32_t SubSerialize(WritableFontData* new_data);
+ IntegerList* OffsetArray();
void SetOffsetArray(const IntegerList& offset_array);
CALLER_ATTACH BitmapGlyphInfoIter* Iterator();
diff --git a/sfntly/table/bitmap/index_sub_table_format2.cc b/sfntly/table/bitmap/index_sub_table_format2.cc
index e54481b..58881f4 100644
--- a/sfntly/table/bitmap/index_sub_table_format2.cc
+++ b/sfntly/table/bitmap/index_sub_table_format2.cc
@@ -78,8 +78,8 @@ int32_t IndexSubTableFormat2::Builder::GlyphLength(int32_t glyph_id) {
return ImageSize();
}
-CALLER_ATTACH
-BitmapGlyphInfoIter* IndexSubTableFormat2::Builder::GetIterator() {
+CALLER_ATTACH IndexSubTableFormat2::Builder::BitmapGlyphInfoIterator*
+ IndexSubTableFormat2::Builder::GetIterator() {
Ptr<IndexSubTableFormat2::Builder::BitmapGlyphInfoIterator> it =
new IndexSubTableFormat2::Builder::BitmapGlyphInfoIterator(this);
return it.Detach();
diff --git a/sfntly/table/bitmap/index_sub_table_format2.h b/sfntly/table/bitmap/index_sub_table_format2.h
index 7b13d60..52a9ae0 100644
--- a/sfntly/table/bitmap/index_sub_table_format2.h
+++ b/sfntly/table/bitmap/index_sub_table_format2.h
@@ -45,7 +45,7 @@ class IndexSubTableFormat2 : public IndexSubTable,
virtual int32_t NumGlyphs();
virtual int32_t GlyphStartOffset(int32_t glyph_id);
virtual int32_t GlyphLength(int32_t glyph_id);
- CALLER_ATTACH virtual BitmapGlyphInfoIter* GetIterator();
+ CALLER_ATTACH virtual BitmapGlyphInfoIterator* GetIterator();
virtual CALLER_ATTACH FontDataTable* SubBuildTable(ReadableFontData* data);
virtual void SubDataSet();
diff --git a/sfntly/table/bitmap/index_sub_table_format3.cc b/sfntly/table/bitmap/index_sub_table_format3.cc
index 75ff14c..eedc500 100644
--- a/sfntly/table/bitmap/index_sub_table_format3.cc
+++ b/sfntly/table/bitmap/index_sub_table_format3.cc
@@ -95,8 +95,8 @@ int32_t IndexSubTableFormat3::Builder::GlyphLength(int32_t glyph_id) {
return offset_array->at(loca + 1) - offset_array->at(loca);
}
-CALLER_ATTACH
-BitmapGlyphInfoIter* IndexSubTableFormat3::Builder::GetIterator() {
+CALLER_ATTACH IndexSubTableFormat3::Builder::BitmapGlyphInfoIterator*
+ IndexSubTableFormat3::Builder::GetIterator() {
Ptr<IndexSubTableFormat3::Builder::BitmapGlyphInfoIterator> it =
new IndexSubTableFormat3::Builder::BitmapGlyphInfoIterator(this);
return it.Detach();
@@ -225,9 +225,9 @@ void IndexSubTableFormat3::Builder::Initialize(ReadableFontData* data) {
if (data) {
int32_t num_offsets = (last_glyph_index() - first_glyph_index() + 1) + 1;
for (int32_t i = 0; i < num_offsets; ++i) {
- offset_array_.push_back(data->ReadULongAsInt(
+ offset_array_.push_back(data->ReadUShort(
EblcTable::Offset::kIndexSubTable3_offsetArray +
- i * DataSize::kULONG));
+ i * DataSize::kUSHORT));
}
}
}
diff --git a/sfntly/table/bitmap/index_sub_table_format3.h b/sfntly/table/bitmap/index_sub_table_format3.h
index 2c4004c..e9f1fa2 100644
--- a/sfntly/table/bitmap/index_sub_table_format3.h
+++ b/sfntly/table/bitmap/index_sub_table_format3.h
@@ -44,7 +44,7 @@ class IndexSubTableFormat3 : public IndexSubTable,
virtual int32_t NumGlyphs();
virtual int32_t GlyphStartOffset(int32_t glyph_id);
virtual int32_t GlyphLength(int32_t glyph_id);
- CALLER_ATTACH virtual BitmapGlyphInfoIter* GetIterator();
+ CALLER_ATTACH virtual BitmapGlyphInfoIterator* GetIterator();
virtual CALLER_ATTACH FontDataTable* SubBuildTable(ReadableFontData* data);
virtual void SubDataSet();
diff --git a/sfntly/table/bitmap/index_sub_table_format4.cc b/sfntly/table/bitmap/index_sub_table_format4.cc
index efa5f28..898e288 100644
--- a/sfntly/table/bitmap/index_sub_table_format4.cc
+++ b/sfntly/table/bitmap/index_sub_table_format4.cc
@@ -92,6 +92,10 @@ IndexSubTableFormat4::CodeOffsetPair::CodeOffsetPair(int32_t glyph_code,
: glyph_code_(glyph_code), offset_(offset) {
}
+IndexSubTableFormat4::CodeOffsetPairBuilder::CodeOffsetPairBuilder()
+ : CodeOffsetPair(0, 0) {
+}
+
IndexSubTableFormat4::CodeOffsetPairBuilder::CodeOffsetPairBuilder(
int32_t glyph_code, int32_t offset)
: CodeOffsetPair(glyph_code, offset) {
@@ -137,8 +141,8 @@ int32_t IndexSubTableFormat4::Builder::GlyphStartOffset(int32_t glyph_id) {
return GetOffsetArray()->at(pair_index).offset();
}
-CALLER_ATTACH
-BitmapGlyphInfoIter* IndexSubTableFormat4::Builder::GetIterator() {
+CALLER_ATTACH IndexSubTableFormat4::Builder::BitmapGlyphInfoIterator*
+ IndexSubTableFormat4::Builder::GetIterator() {
Ptr<IndexSubTableFormat4::Builder::BitmapGlyphInfoIterator> it =
new IndexSubTableFormat4::Builder::BitmapGlyphInfoIterator(this);
return it.Detach();
diff --git a/sfntly/table/bitmap/index_sub_table_format4.h b/sfntly/table/bitmap/index_sub_table_format4.h
index 258998d..be96628 100644
--- a/sfntly/table/bitmap/index_sub_table_format4.h
+++ b/sfntly/table/bitmap/index_sub_table_format4.h
@@ -40,12 +40,12 @@ class IndexSubTableFormat4 : public IndexSubTable,
class Builder;
class CodeOffsetPairBuilder : public CodeOffsetPair {
public:
+ CodeOffsetPairBuilder();
+ CodeOffsetPairBuilder(int32_t glyph_code, int32_t offset);
void set_glyph_code(int32_t v) { glyph_code_ = v; }
void set_offset(int32_t v) { offset_ = v; }
private:
- CodeOffsetPairBuilder(int32_t glyph_code, int32_t offset);
-
friend class Builder;
};
@@ -74,7 +74,7 @@ class IndexSubTableFormat4 : public IndexSubTable,
virtual int32_t NumGlyphs();
virtual int32_t GlyphLength(int32_t glyph_id);
virtual int32_t GlyphStartOffset(int32_t glyph_id);
- CALLER_ATTACH virtual BitmapGlyphInfoIter* GetIterator();
+ CALLER_ATTACH virtual BitmapGlyphInfoIterator* GetIterator();
virtual CALLER_ATTACH FontDataTable* SubBuildTable(ReadableFontData* data);
virtual void SubDataSet();
@@ -130,7 +130,8 @@ class IndexSubTableFormat4 : public IndexSubTable,
};
typedef Ptr<IndexSubTableFormat4> IndexSubTableFormat4Ptr;
typedef Ptr<IndexSubTableFormat4::Builder> IndexSubTableFormat4BuilderPtr;
-
+typedef std::vector<IndexSubTableFormat4::CodeOffsetPairBuilder>
+ CodeOffsetPairBuilderList;
} // namespace sfntly
#endif // SFNTLY_CPP_SRC_SFNTLY_TABLE_BITMAP_INDEX_SUBTABLE_FORMAT4_H_
diff --git a/sfntly/table/bitmap/index_sub_table_format5.cc b/sfntly/table/bitmap/index_sub_table_format5.cc
index 7ba78ec..1ddce05 100644
--- a/sfntly/table/bitmap/index_sub_table_format5.cc
+++ b/sfntly/table/bitmap/index_sub_table_format5.cc
@@ -79,8 +79,7 @@ IndexSubTableFormat5::IndexSubTableFormat5(ReadableFontData* data,
// static
int32_t IndexSubTableFormat5::NumGlyphs(ReadableFontData* data,
int32_t table_offset) {
- UNREFERENCED_PARAMETER(table_offset);
- int32_t num_glyphs = data->ReadULongAsInt(
+ int32_t num_glyphs = data->ReadULongAsInt(table_offset +
EblcTable::Offset::kIndexSubTable5_numGlyphs);
return num_glyphs;
}
@@ -115,8 +114,8 @@ int32_t IndexSubTableFormat5::Builder::GlyphStartOffset(int32_t glyph_id) {
return (it - glyph_array->begin()) * ImageSize();
}
-CALLER_ATTACH
-BitmapGlyphInfoIter* IndexSubTableFormat5::Builder::GetIterator() {
+CALLER_ATTACH IndexSubTableFormat5::Builder::BitmapGlyphInfoIterator*
+ IndexSubTableFormat5::Builder::GetIterator() {
Ptr<IndexSubTableFormat5::Builder::BitmapGlyphInfoIterator> it =
new IndexSubTableFormat5::Builder::BitmapGlyphInfoIterator(this);
return it.Detach();
@@ -282,7 +281,7 @@ void IndexSubTableFormat5::Builder::Initialize(ReadableFontData* data) {
if (data) {
int32_t num_glyphs = IndexSubTableFormat5::NumGlyphs(data, 0);
for (int32_t i = 0; i < num_glyphs; ++i) {
- glyph_array_.push_back(data->ReadULongAsInt(
+ glyph_array_.push_back(data->ReadUShort(
EblcTable::Offset::kIndexSubTable5_glyphArray +
i * DataSize::kUSHORT));
}
diff --git a/sfntly/table/bitmap/index_sub_table_format5.h b/sfntly/table/bitmap/index_sub_table_format5.h
index c480fd8..511f1fc 100644
--- a/sfntly/table/bitmap/index_sub_table_format5.h
+++ b/sfntly/table/bitmap/index_sub_table_format5.h
@@ -44,7 +44,7 @@ class IndexSubTableFormat5 : public IndexSubTable,
virtual int32_t NumGlyphs();
virtual int32_t GlyphLength(int32_t glyph_id);
virtual int32_t GlyphStartOffset(int32_t glyph_id);
- CALLER_ATTACH virtual BitmapGlyphInfoIter* GetIterator();
+ CALLER_ATTACH virtual BitmapGlyphInfoIterator* GetIterator();
virtual CALLER_ATTACH FontDataTable* SubBuildTable(ReadableFontData* data);
virtual void SubDataSet();