diff options
author | dfilimon@google.com <dfilimon@google.com@672e30a5-4c29-85ac-ac6d-611c735e0a51> | 2011-09-21 03:56:38 +0000 |
---|---|---|
committer | dfilimon@google.com <dfilimon@google.com@672e30a5-4c29-85ac-ac6d-611c735e0a51> | 2011-09-21 03:56:38 +0000 |
commit | 8c433a9f5819ad995a14c8476c266487c8a82f53 (patch) | |
tree | b68875ef7c5f118807a098f43e4ff493eb97095b /sample/subtly/font_assembler.h | |
parent | 09f3dda615ba59d0b686e8c36f1e8426b9235746 (diff) | |
download | src-8c433a9f5819ad995a14c8476c266487c8a82f53.tar.gz |
Added sample subsetter and merger.
git-svn-id: http://sfntly.googlecode.com/svn/trunk/cpp/src@91 672e30a5-4c29-85ac-ac6d-611c735e0a51
Diffstat (limited to 'sample/subtly/font_assembler.h')
-rw-r--r-- | sample/subtly/font_assembler.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/sample/subtly/font_assembler.h b/sample/subtly/font_assembler.h new file mode 100644 index 0000000..c53c21f --- /dev/null +++ b/sample/subtly/font_assembler.h @@ -0,0 +1,67 @@ +/* + * Copyright 2011 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TYPOGRAPHY_FONT_SFNTLY_SRC_SAMPLE_SUBTLY_FONT_ASSEMBLER_H_ +#define TYPOGRAPHY_FONT_SFNTLY_SRC_SAMPLE_SUBTLY_FONT_ASSEMBLER_H_ + +#include <set> +#include <map> + +#include "subtly/font_info.h" + +#include "sfntly/tag.h" +#include "sfntly/font.h" +#include "sfntly/port/type.h" +#include "sfntly/port/refcount.h" +#include "sfntly/table/core/cmap_table.h" +#include "sfntly/table/truetype/glyph_table.h" +#include "sfntly/table/truetype/loca_table.h" + +namespace subtly { +// Assembles FontInfo into font builders. +// Does not take ownership of data passed to it. +class FontAssembler : public sfntly::RefCounted<FontAssembler> { + public: + // font_info is the FontInfo which will be used for the new font + // table_blacklist is used to decide which tables to exclude from the + // final font. + FontAssembler(FontInfo* font_info, sfntly::IntegerSet* table_blacklist); + explicit FontAssembler(FontInfo* font_info); + ~FontAssembler() { } + + // Assemble a new font from the font info object. + virtual CALLER_ATTACH sfntly::Font* Assemble(); + + sfntly::IntegerSet* table_blacklist() const { return table_blacklist_; } + void set_table_blacklist(sfntly::IntegerSet* table_blacklist) { + table_blacklist_ = table_blacklist; + } + + protected: + virtual bool AssembleCMapTable(); + virtual bool AssembleGlyphAndLocaTables(); + + virtual void Initialize(); + + private: + sfntly::Ptr<FontInfo> font_info_; + sfntly::Ptr<sfntly::FontFactory> font_factory_; + sfntly::Ptr<sfntly::Font::Builder> font_builder_; + sfntly::IntegerSet* table_blacklist_; +}; +} + +#endif // TYPOGRAPHY_FONT_SFNTLY_SRC_SAMPLE_SUBTLY_FONT_ASSEMBLER_H_ |