Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/woff2/src/glyph.h

Issue 954163002: Add woff2 to src/third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase as third_party/ots/src/woff2.cc has changed Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/woff2/src/font.cc ('k') | third_party/woff2/src/glyph.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // Data model and I/O for glyph data within sfnt format files for the purpose of
16 // performing the preprocessing step of the WOFF 2.0 conversion.
17
18 #ifndef WOFF2_GLYPH_H_
19 #define WOFF2_GLYPH_H_
20
21 #include <stddef.h>
22 #include <inttypes.h>
23 #include <vector>
24
25 namespace woff2 {
26
27 // Represents a parsed simple or composite glyph. The composite glyph data and
28 // instructions are un-parsed and we keep only pointers to the raw data,
29 // therefore the glyph is valid only so long the data from which it was parsed
30 // is around.
31 class Glyph {
32 public:
33 Glyph() : instructions_size(0), composite_data_size(0) {}
34
35 // Bounding box.
36 int16_t x_min;
37 int16_t x_max;
38 int16_t y_min;
39 int16_t y_max;
40
41 // Instructions.
42 uint16_t instructions_size;
43 const uint8_t* instructions_data;
44
45 // Data model for simple glyphs.
46 struct Point {
47 int x;
48 int y;
49 bool on_curve;
50 };
51 std::vector<std::vector<Point> > contours;
52
53 // Data for composite glyphs.
54 const uint8_t* composite_data;
55 uint32_t composite_data_size;
56 bool have_instructions;
57 };
58
59 // Parses the glyph from the given data. Returns false on parsing failure or
60 // buffer overflow. The glyph is valid only so long the input data pointer is
61 // valid.
62 bool ReadGlyph(const uint8_t* data, size_t len, Glyph* glyph);
63
64 // Stores the glyph into the specified dst buffer. The *dst_size is the buffer
65 // size on entry and is set to the actual (unpadded) stored size on exit.
66 // Returns false on buffer overflow.
67 bool StoreGlyph(const Glyph& glyph, uint8_t* dst, size_t* dst_size);
68
69 } // namespace woff2
70
71 #endif // WOFF2_GLYPH_H_
OLDNEW
« no previous file with comments | « third_party/woff2/src/font.cc ('k') | third_party/woff2/src/glyph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698