| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Brent Fulgham | 2 * Copyright (C) 2011 Brent Fulgham |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #if OS(MACOSX) | 34 #if OS(MACOSX) |
| 35 #include "third_party/skia/include/ports/SkTypeface_mac.h" | 35 #include "third_party/skia/include/ports/SkTypeface_mac.h" |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 using namespace std; | 38 using namespace std; |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType) | 42 FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType) |
| 43 : m_typeface(nullptr) | 43 : m_typeface(nullptr) |
| 44 #if !OS(WIN) | |
| 45 , m_family(CString()) | |
| 46 #endif | |
| 47 , m_textSize(0) | 44 , m_textSize(0) |
| 48 , m_syntheticBold(false) | 45 , m_syntheticBold(false) |
| 49 , m_syntheticItalic(false) | 46 , m_syntheticItalic(false) |
| 50 , m_orientation(FontOrientation::Horizontal) | 47 , m_orientation(FontOrientation::Horizontal) |
| 51 #if !OS(MACOSX) | |
| 52 , m_style(FontRenderStyle()) | |
| 53 #endif | |
| 54 , m_isHashTableDeletedValue(true) | 48 , m_isHashTableDeletedValue(true) |
| 55 #if OS(WIN) | 49 #if OS(WIN) |
| 56 , m_paintTextFlags(0) | 50 , m_paintTextFlags(0) |
| 57 , m_minSizeForAntiAlias(0) | 51 , m_minSizeForAntiAlias(0) |
| 58 , m_minSizeForSubpixel(0) | 52 , m_minSizeForSubpixel(0) |
| 59 #endif | 53 #endif |
| 60 { | 54 { |
| 61 } | 55 } |
| 62 | 56 |
| 63 FontPlatformData::FontPlatformData() | 57 FontPlatformData::FontPlatformData() |
| 64 : m_typeface(nullptr) | 58 : m_typeface(nullptr) |
| 65 #if !OS(WIN) | |
| 66 , m_family(CString()) | |
| 67 #endif | |
| 68 , m_textSize(0) | 59 , m_textSize(0) |
| 69 , m_syntheticBold(false) | 60 , m_syntheticBold(false) |
| 70 , m_syntheticItalic(false) | 61 , m_syntheticItalic(false) |
| 71 , m_orientation(FontOrientation::Horizontal) | 62 , m_orientation(FontOrientation::Horizontal) |
| 72 #if !OS(MACOSX) | |
| 73 , m_style(FontRenderStyle()) | |
| 74 #endif | |
| 75 , m_isHashTableDeletedValue(false) | 63 , m_isHashTableDeletedValue(false) |
| 76 #if OS(WIN) | 64 #if OS(WIN) |
| 77 , m_paintTextFlags(0) | 65 , m_paintTextFlags(0) |
| 78 , m_minSizeForAntiAlias(0) | 66 , m_minSizeForAntiAlias(0) |
| 79 , m_minSizeForSubpixel(0) | 67 , m_minSizeForSubpixel(0) |
| 80 #endif | 68 #endif |
| 81 { | 69 { |
| 82 } | 70 } |
| 83 | 71 |
| 84 FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheti
cItalic, FontOrientation orientation) | 72 FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheti
cItalic, FontOrientation orientation) |
| 85 : m_typeface(nullptr) | 73 : m_typeface(nullptr) |
| 86 #if !OS(WIN) | |
| 87 , m_family(CString()) | |
| 88 #endif | |
| 89 , m_textSize(size) | 74 , m_textSize(size) |
| 90 , m_syntheticBold(syntheticBold) | 75 , m_syntheticBold(syntheticBold) |
| 91 , m_syntheticItalic(syntheticItalic) | 76 , m_syntheticItalic(syntheticItalic) |
| 92 , m_orientation(orientation) | 77 , m_orientation(orientation) |
| 93 #if !OS(MACOSX) | |
| 94 , m_style(FontRenderStyle()) | |
| 95 #endif | |
| 96 , m_isHashTableDeletedValue(false) | 78 , m_isHashTableDeletedValue(false) |
| 97 #if OS(WIN) | 79 #if OS(WIN) |
| 98 , m_paintTextFlags(0) | 80 , m_paintTextFlags(0) |
| 99 , m_minSizeForAntiAlias(0) | 81 , m_minSizeForAntiAlias(0) |
| 100 , m_minSizeForSubpixel(0) | 82 , m_minSizeForSubpixel(0) |
| 101 #endif | 83 #endif |
| 102 { | 84 { |
| 103 } | 85 } |
| 104 | 86 |
| 105 FontPlatformData::FontPlatformData(const FontPlatformData& source) | 87 FontPlatformData::FontPlatformData(const FontPlatformData& source) |
| 106 : m_typeface(source.m_typeface) | 88 : m_typeface(source.m_typeface) |
| 107 #if !OS(WIN) | 89 #if !OS(WIN) |
| 108 , m_family(source.m_family) | 90 , m_family(source.m_family) |
| 109 #endif | 91 #endif |
| 110 , m_textSize(source.m_textSize) | 92 , m_textSize(source.m_textSize) |
| 111 , m_syntheticBold(source.m_syntheticBold) | 93 , m_syntheticBold(source.m_syntheticBold) |
| 112 , m_syntheticItalic(source.m_syntheticItalic) | 94 , m_syntheticItalic(source.m_syntheticItalic) |
| 113 , m_orientation(source.m_orientation) | 95 , m_orientation(source.m_orientation) |
| 114 #if !OS(MACOSX) | 96 #if OS(LINUX) || OS(ANDROID) |
| 115 , m_style(source.m_style) | 97 , m_style(source.m_style) |
| 116 #endif | 98 #endif |
| 117 , m_harfBuzzFace(nullptr) | 99 , m_harfBuzzFace(nullptr) |
| 118 , m_isHashTableDeletedValue(false) | 100 , m_isHashTableDeletedValue(false) |
| 119 #if OS(WIN) | 101 #if OS(WIN) |
| 120 , m_paintTextFlags(source.m_paintTextFlags) | 102 , m_paintTextFlags(source.m_paintTextFlags) |
| 121 , m_minSizeForAntiAlias(source.m_minSizeForAntiAlias) | 103 , m_minSizeForAntiAlias(source.m_minSizeForAntiAlias) |
| 122 , m_minSizeForSubpixel(source.m_minSizeForSubpixel) | 104 , m_minSizeForSubpixel(source.m_minSizeForSubpixel) |
| 123 #endif | 105 #endif |
| 124 { | 106 { |
| 125 } | 107 } |
| 126 | 108 |
| 127 FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize) | 109 FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize) |
| 128 : m_typeface(src.m_typeface) | 110 : m_typeface(src.m_typeface) |
| 129 #if !OS(WIN) | 111 #if !OS(WIN) |
| 130 , m_family(src.m_family) | 112 , m_family(src.m_family) |
| 131 #endif | 113 #endif |
| 132 , m_textSize(textSize) | 114 , m_textSize(textSize) |
| 133 , m_syntheticBold(src.m_syntheticBold) | 115 , m_syntheticBold(src.m_syntheticBold) |
| 134 , m_syntheticItalic(src.m_syntheticItalic) | 116 , m_syntheticItalic(src.m_syntheticItalic) |
| 135 , m_orientation(src.m_orientation) | 117 , m_orientation(src.m_orientation) |
| 136 #if !OS(MACOSX) | 118 #if OS(LINUX) || OS(ANDROID) |
| 137 , m_style(src.m_style) | 119 , m_style(src.m_style) |
| 138 #endif | 120 #endif |
| 139 , m_harfBuzzFace(nullptr) | 121 , m_harfBuzzFace(nullptr) |
| 140 , m_isHashTableDeletedValue(false) | 122 , m_isHashTableDeletedValue(false) |
| 141 #if OS(WIN) | 123 #if OS(WIN) |
| 142 , m_paintTextFlags(src.m_paintTextFlags) | 124 , m_paintTextFlags(src.m_paintTextFlags) |
| 143 , m_minSizeForAntiAlias(src.m_minSizeForAntiAlias) | 125 , m_minSizeForAntiAlias(src.m_minSizeForAntiAlias) |
| 144 , m_minSizeForSubpixel(src.m_minSizeForSubpixel) | 126 , m_minSizeForSubpixel(src.m_minSizeForSubpixel) |
| 145 #endif | 127 #endif |
| 146 { | 128 { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 178 |
| 197 m_typeface = other.m_typeface; | 179 m_typeface = other.m_typeface; |
| 198 #if !OS(WIN) | 180 #if !OS(WIN) |
| 199 m_family = other.m_family; | 181 m_family = other.m_family; |
| 200 #endif | 182 #endif |
| 201 m_textSize = other.m_textSize; | 183 m_textSize = other.m_textSize; |
| 202 m_syntheticBold = other.m_syntheticBold; | 184 m_syntheticBold = other.m_syntheticBold; |
| 203 m_syntheticItalic = other.m_syntheticItalic; | 185 m_syntheticItalic = other.m_syntheticItalic; |
| 204 m_harfBuzzFace = nullptr; | 186 m_harfBuzzFace = nullptr; |
| 205 m_orientation = other.m_orientation; | 187 m_orientation = other.m_orientation; |
| 206 #if !OS(MACOSX) | 188 #if OS(LINUX) || OS(ANDROID) |
| 207 m_style = other.m_style; | 189 m_style = other.m_style; |
| 208 #endif | 190 #endif |
| 209 | 191 |
| 210 #if OS(WIN) | 192 #if OS(WIN) |
| 211 m_paintTextFlags = 0; | 193 m_paintTextFlags = 0; |
| 212 m_minSizeForAntiAlias = other.m_minSizeForAntiAlias; | 194 m_minSizeForAntiAlias = other.m_minSizeForAntiAlias; |
| 213 m_minSizeForSubpixel = other.m_minSizeForSubpixel; | 195 m_minSizeForSubpixel = other.m_minSizeForSubpixel; |
| 214 #endif | 196 #endif |
| 215 | 197 |
| 216 return *this; | 198 return *this; |
| 217 } | 199 } |
| 218 | 200 |
| 219 bool FontPlatformData::operator==(const FontPlatformData& a) const | 201 bool FontPlatformData::operator==(const FontPlatformData& a) const |
| 220 { | 202 { |
| 221 // If either of the typeface pointers are null then we test for pointer | 203 // If either of the typeface pointers are null then we test for pointer |
| 222 // equality. Otherwise, we call SkTypeface::Equal on the valid pointers. | 204 // equality. Otherwise, we call SkTypeface::Equal on the valid pointers. |
| 223 bool typefacesEqual = false; | 205 bool typefacesEqual = false; |
| 224 if (!typeface() || !a.typeface()) | 206 if (!typeface() || !a.typeface()) |
| 225 typefacesEqual = typeface() == a.typeface(); | 207 typefacesEqual = typeface() == a.typeface(); |
| 226 else | 208 else |
| 227 typefacesEqual = SkTypeface::Equal(typeface(), a.typeface()); | 209 typefacesEqual = SkTypeface::Equal(typeface(), a.typeface()); |
| 228 | 210 |
| 229 return typefacesEqual | 211 return typefacesEqual |
| 230 && m_textSize == a.m_textSize | 212 && m_textSize == a.m_textSize |
| 231 && m_isHashTableDeletedValue == a.m_isHashTableDeletedValue | 213 && m_isHashTableDeletedValue == a.m_isHashTableDeletedValue |
| 232 && m_syntheticBold == a.m_syntheticBold | 214 && m_syntheticBold == a.m_syntheticBold |
| 233 && m_syntheticItalic == a.m_syntheticItalic | 215 && m_syntheticItalic == a.m_syntheticItalic |
| 234 #if !OS(MACOSX) | 216 #if OS(LINUX) || OS(ANDROID) |
| 235 && m_style == a.m_style | 217 && m_style == a.m_style |
| 236 #endif | 218 #endif |
| 237 && m_orientation == a.m_orientation; | 219 && m_orientation == a.m_orientation; |
| 238 } | 220 } |
| 239 | 221 |
| 240 SkFontID FontPlatformData::uniqueID() const | 222 SkFontID FontPlatformData::uniqueID() const |
| 241 { | 223 { |
| 242 return typeface()->uniqueID(); | 224 return typeface()->uniqueID(); |
| 243 } | 225 } |
| 244 | 226 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 const size_t tableSize = m_typeface->getTableSize(tag); | 337 const size_t tableSize = m_typeface->getTableSize(tag); |
| 356 if (tableSize) { | 338 if (tableSize) { |
| 357 Vector<char> tableBuffer(tableSize); | 339 Vector<char> tableBuffer(tableSize); |
| 358 m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]); | 340 m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]); |
| 359 buffer = SharedBuffer::adoptVector(tableBuffer); | 341 buffer = SharedBuffer::adoptVector(tableBuffer); |
| 360 } | 342 } |
| 361 return buffer.release(); | 343 return buffer.release(); |
| 362 } | 344 } |
| 363 | 345 |
| 364 } // namespace blink | 346 } // namespace blink |
| OLD | NEW |