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

Side by Side Diff: Source/platform/fonts/FontPlatformData.cpp

Issue 542653002: Merge FontPlatformDataHarfBuzz and FontPlatformData headers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@mergePlatformData
Patch Set: Argument name incorrect Created 6 years, 3 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
OLDNEW
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 * 18 *
19 */ 19 */
20 20
21 #include "config.h" 21 #include "config.h"
22 #include "platform/fonts/FontPlatformData.h" 22 #include "platform/fonts/FontPlatformData.h"
23 23
24 #include "SkTypeface.h"
25 #include "platform/fonts/harfbuzz/HarfBuzzFace.h"
24 #include "wtf/HashMap.h" 26 #include "wtf/HashMap.h"
25 #include "wtf/text/StringHash.h" 27 #include "wtf/text/StringHash.h"
26 #include "wtf/text/WTFString.h" 28 #include "wtf/text/WTFString.h"
27 29
28 #if OS(MACOSX) 30 #if OS(MACOSX)
29 #include "platform/fonts/harfbuzz/HarfBuzzFace.h" 31 #include "platform/fonts/harfbuzz/HarfBuzzFace.h"
30 #endif 32 #endif
31 33
34 using namespace std;
35
32 namespace blink { 36 namespace blink {
33 37
34 FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType) 38 FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType)
35 : m_syntheticBold(false) 39 : m_textSize(0)
36 , m_syntheticOblique(false) 40 , m_syntheticBold(false)
41 , m_syntheticItalic(false)
37 , m_orientation(Horizontal) 42 , m_orientation(Horizontal)
38 , m_size(0) 43 , m_isColorBitmapFont(false)
44 , m_isCompositeFontReference(false)
39 , m_widthVariant(RegularWidth) 45 , m_widthVariant(RegularWidth)
40 #if OS(MACOSX) 46 #if OS(MACOSX)
41 , m_font(hashTableDeletedFontValue()) 47 , m_font(nullptr)
42 #endif 48 #endif
43 , m_isColorBitmapFont(false) 49 , m_isHashTableDeletedValue(true)
44 , m_isCompositeFontReference(false)
45 { 50 {
46 } 51 }
47 52
48 FontPlatformData::FontPlatformData() 53 FontPlatformData::FontPlatformData()
49 : m_syntheticBold(false) 54 : m_textSize(0)
50 , m_syntheticOblique(false) 55 , m_syntheticBold(false)
56 , m_syntheticItalic(false)
51 , m_orientation(Horizontal) 57 , m_orientation(Horizontal)
52 , m_size(0) 58 , m_isColorBitmapFont(false)
59 , m_isCompositeFontReference(false)
53 , m_widthVariant(RegularWidth) 60 , m_widthVariant(RegularWidth)
54 #if OS(MACOSX) 61 #if OS(MACOSX)
55 , m_font(0) 62 , m_font(nullptr)
56 #endif 63 #endif
57 , m_isColorBitmapFont(false) 64 , m_isHashTableDeletedValue(false)
58 , m_isCompositeFontReference(false)
59 { 65 {
60 } 66 }
61 67
62 FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheti cOblique, FontOrientation orientation, FontWidthVariant widthVariant) 68 FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheti cItalic, FontOrientation orientation, FontWidthVariant widthVariant)
63 : m_syntheticBold(syntheticBold) 69 : m_textSize(size)
64 , m_syntheticOblique(syntheticOblique) 70 , m_syntheticBold(syntheticBold)
71 , m_syntheticItalic(syntheticItalic)
65 , m_orientation(orientation) 72 , m_orientation(orientation)
66 , m_size(size) 73 , m_isColorBitmapFont(false)
74 , m_isCompositeFontReference(false)
67 , m_widthVariant(widthVariant) 75 , m_widthVariant(widthVariant)
68 #if OS(MACOSX) 76 #if OS(MACOSX)
69 , m_font(0) 77 , m_font(nullptr)
70 #endif 78 #endif
71 , m_isColorBitmapFont(false) 79 , m_isHashTableDeletedValue(false)
72 , m_isCompositeFontReference(false)
73 { 80 {
74 } 81 }
75 82
76 #if OS(MACOSX) 83 #if OS(MACOSX)
77 FontPlatformData::FontPlatformData(CGFontRef cgFont, float size, bool syntheticB old, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthV ariant) 84 FontPlatformData::FontPlatformData(CGFontRef cgFont, float size, bool syntheticB old, bool syntheticItalic, FontOrientation orientation, FontWidthVariant widthVa riant)
78 : m_syntheticBold(syntheticBold) 85 : m_textSize(size)
79 , m_syntheticOblique(syntheticOblique) 86 , m_syntheticBold(syntheticBold)
87 , m_syntheticItalic(syntheticItalic)
80 , m_orientation(orientation) 88 , m_orientation(orientation)
81 , m_size(size)
82 , m_widthVariant(widthVariant)
83 , m_font(0)
84 , m_cgFont(cgFont)
85 , m_isColorBitmapFont(false) 89 , m_isColorBitmapFont(false)
86 , m_isCompositeFontReference(false) 90 , m_isCompositeFontReference(false)
91 , m_widthVariant(widthVariant)
92 , m_font(nullptr)
93 , m_cgFont(cgFont)
94 , m_isHashTableDeletedValue(false)
87 { 95 {
88 } 96 }
89 #endif 97 #endif
90 98
91 FontPlatformData::FontPlatformData(const FontPlatformData& source) 99 FontPlatformData::FontPlatformData(const FontPlatformData& source)
92 : m_syntheticBold(source.m_syntheticBold) 100 : m_textSize(source.m_textSize)
93 , m_syntheticOblique(source.m_syntheticOblique) 101 , m_syntheticBold(source.m_syntheticBold)
102 , m_syntheticItalic(source.m_syntheticItalic)
94 , m_orientation(source.m_orientation) 103 , m_orientation(source.m_orientation)
95 , m_size(source.m_size)
96 , m_widthVariant(source.m_widthVariant)
97 , m_isColorBitmapFont(source.m_isColorBitmapFont) 104 , m_isColorBitmapFont(source.m_isColorBitmapFont)
98 , m_isCompositeFontReference(source.m_isCompositeFontReference) 105 , m_isCompositeFontReference(source.m_isCompositeFontReference)
106 , m_widthVariant(source.m_widthVariant)
107 , m_isHashTableDeletedValue(false)
99 { 108 {
100 platformDataInit(source); 109 platformDataInit(source);
101 } 110 }
102 111
103 const FontPlatformData& FontPlatformData::operator=(const FontPlatformData& othe r) 112 const FontPlatformData& FontPlatformData::operator=(const FontPlatformData& othe r)
104 { 113 {
105 // Check for self-assignment. 114 // Check for self-assignment.
106 if (this == &other) 115 if (this == &other)
107 return *this; 116 return *this;
108 117
109 m_syntheticBold = other.m_syntheticBold; 118 m_syntheticBold = other.m_syntheticBold;
110 m_syntheticOblique = other.m_syntheticOblique; 119 m_syntheticItalic = other.m_syntheticItalic;
111 m_orientation = other.m_orientation; 120 m_orientation = other.m_orientation;
112 m_size = other.m_size; 121 m_textSize = other.m_textSize;
113 m_widthVariant = other.m_widthVariant; 122 m_widthVariant = other.m_widthVariant;
114 m_isColorBitmapFont = other.m_isColorBitmapFont; 123 m_isColorBitmapFont = other.m_isColorBitmapFont;
115 m_isCompositeFontReference = other.m_isCompositeFontReference; 124 m_isCompositeFontReference = other.m_isCompositeFontReference;
116 125
117 return platformDataAssign(other); 126 return platformDataAssign(other);
118 } 127 }
119 128
129 bool FontPlatformData::operator==(const FontPlatformData& a) const
130 {
131
132 return platformIsEqual(a)
133 && m_textSize == a.m_textSize
134 && m_isHashTableDeletedValue == a.m_isHashTableDeletedValue
135 && m_syntheticBold == a.m_syntheticBold
136 && m_syntheticItalic == a.m_syntheticItalic
137 && m_orientation == a.m_orientation
138 #if !OS(MACOSX)
139 && m_style == a.m_style
140 #endif
141 && m_isColorBitmapFont == a.m_isColorBitmapFont
142 && m_isCompositeFontReference == a.m_isCompositeFontReference
143 && m_widthVariant == a.m_widthVariant;
144 }
145
146
120 } // namespace blink 147 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/FontPlatformData.h ('k') | Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698