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 BitmapGlyphInfo::BitmapGlyphInfo(int32_t glyph_id, 22 int32_t block_offset, 23 int32_t start_offset, 24 int32_t length, 25 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 format_(format) { 32 } 33 34 BitmapGlyphInfo::BitmapGlyphInfo(int32_t glyph_id, 35 int32_t start_offset, 36 int32_t length, 37 int32_t format) 38 : glyph_id_(glyph_id), 39 relative_(false), 40 block_offset_(0), 41 start_offset_(start_offset), 42 length_(length), 43 format_(format) { 44 } 45 46 bool BitmapGlyphInfo::operator==(const BitmapGlyphInfo& rhs) const { 47 return (format_ == rhs.format_ && 48 glyph_id_ == rhs.glyph_id_ && 49 length_ == rhs.length_ && 50 offset() == rhs.offset()); 51 } 52 53 bool BitmapGlyphInfo::operator==(BitmapGlyphInfo* rhs) { 54 if (rhs == NULL) { 55 return this == NULL; 56 } 57 return (format_ == rhs->format() && 58 glyph_id_ == rhs->glyph_id() && 59 length_ == rhs->length() && 60 offset() == rhs->offset()); 61 } 62 63 bool StartOffsetComparator::operator()(BitmapGlyphInfo* lhs, 64 BitmapGlyphInfo* rhs) { 65 return lhs->start_offset() > rhs->start_offset(); 66 } 67 68 } // namespace sfntly 69