Line data Source code
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 : #include "sfntly/table/bitmap/bitmap_glyph_info.h"
18 :
19 : namespace sfntly {
20 :
21 0 : BitmapGlyphInfo::BitmapGlyphInfo(int32_t glyph_id,
22 : int32_t block_offset,
23 : int32_t start_offset,
24 : int32_t length,
25 0 : int32_t format)
26 : : glyph_id_(glyph_id),
27 : relative_(true),
28 : block_offset_(block_offset),
29 : start_offset_(start_offset),
30 : length_(length),
31 0 : format_(format) {
32 0 : }
33 :
34 0 : BitmapGlyphInfo::BitmapGlyphInfo(int32_t glyph_id,
35 : int32_t start_offset,
36 : int32_t length,
37 0 : int32_t format)
38 : : glyph_id_(glyph_id),
39 : relative_(false),
40 : block_offset_(0),
41 : start_offset_(start_offset),
42 : length_(length),
43 0 : format_(format) {
44 0 : }
45 :
46 0 : bool BitmapGlyphInfo::operator==(const BitmapGlyphInfo& rhs) const {
47 0 : return (format_ == rhs.format_ &&
48 0 : glyph_id_ == rhs.glyph_id_ &&
49 0 : length_ == rhs.length_ &&
50 0 : offset() == rhs.offset());
51 : }
52 :
53 0 : bool BitmapGlyphInfo::operator==(BitmapGlyphInfo* rhs) {
54 0 : if (rhs == NULL) {
55 0 : return false; // Well defined C++ code's this is always not null.
56 : }
57 0 : return (format_ == rhs->format() &&
58 0 : glyph_id_ == rhs->glyph_id() &&
59 0 : length_ == rhs->length() &&
60 0 : offset() == rhs->offset());
61 : }
62 :
63 0 : bool StartOffsetComparator::operator()(BitmapGlyphInfo* lhs,
64 : BitmapGlyphInfo* rhs) {
65 0 : return lhs->start_offset() > rhs->start_offset();
66 : }
67 :
68 : } // namespace sfntly
|