Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2011 Google Inc. All Rights Reserved. | |
| 3 * | |
| 4 * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 * you may not use this file except in compliance with the License. | |
| 6 * You may obtain a copy of the License at | |
| 7 * | |
| 8 * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 * | |
| 10 * Unless required by applicable law or agreed to in writing, software | |
| 11 * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 * See the License for the specific language governing permissions and | |
| 14 * limitations under the License. | |
| 15 */ | |
| 16 | |
| 17 #ifndef THIRD_PARTY_SFNTLY_SRC_SUBSETTER_FONT_SUBSETTER_H_ | |
| 18 #define THIRD_PARTY_SFNTLY_SRC_SUBSETTER_FONT_SUBSETTER_H_ | |
| 19 | |
| 20 #include <cstddef> | |
| 21 | |
| 22 class SfntlyWrapper { | |
| 23 public: | |
| 24 | |
| 25 // Font subsetting API | |
| 26 // | |
| 27 // Input TTF/TTC/OTF fonts, specify the glyph IDs to subset, and the subset | |
| 28 // font is returned in |output_buffer| (caller to delete[]). Return value is | |
| 29 // the length of output_buffer allocated. | |
| 30 // | |
| 31 // If subsetting failes, a negative value is returned. If none of the glyph | |
|
vandebo (ex-Chrome)
2011/07/20 16:29:59
nit: fails
arthurhsu
2011/07/20 16:57:07
Done.
| |
| 32 // IDs specified is found, the function will return 0. | |
| 33 // | |
| 34 // |font_name| Font name of the font, required for TTC files. Ifi | |
|
vandebo (ex-Chrome)
2011/07/20 16:29:59
nit: remove "of the font"
nit: Ifi => If
arthurhsu
2011/07/20 16:57:07
Done.
| |
| 35 // specified NULL, the first available font is selected. | |
| 36 // |original_font| Original font file contents. | |
| 37 // |font_size| Size of |original_font| in bytes. | |
| 38 // |glyph_ids| Glyph IDs to subset. If the specified glyph ID is not | |
| 39 // found in the font file, it will be ignored silently. | |
| 40 // |glyph_count| Number of glyph IDs in |glyph_ids| | |
| 41 // |output_buffer| Generated subset font. Caller to delete[]. | |
| 42 static int SubsetFont(const char* font_name, | |
| 43 const unsigned char* original_font, | |
|
vandebo (ex-Chrome)
2011/07/20 16:29:59
const void* ?
arthurhsu
2011/07/20 16:57:07
C++ standard says unsigned char takes one byte, so
| |
| 44 size_t font_size, | |
| 45 const unsigned int* glyph_ids, | |
|
vandebo (ex-Chrome)
2011/07/20 16:29:59
const uint16_t* ?
arthurhsu
2011/07/20 16:57:07
Caller may not include/have stdint.h. We use a bi
| |
| 46 size_t glyph_count, | |
| 47 unsigned char** output_buffer); | |
| 48 }; | |
| 49 | |
| 50 #endif // THIRD_PARTY_SFNTLY_SRC_SUBSETTER_FONT_SUBSETTER_H_ | |
| OLD | NEW |