OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2009, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 FontFaceCreationParams(CString filename, | 75 FontFaceCreationParams(CString filename, |
76 int fontconfig_interface_id, | 76 int fontconfig_interface_id, |
77 int ttc_index = 0) | 77 int ttc_index = 0) |
78 : creation_type_(kCreateFontByFciIdAndTtcIndex), | 78 : creation_type_(kCreateFontByFciIdAndTtcIndex), |
79 filename_(filename), | 79 filename_(filename), |
80 fontconfig_interface_id_(fontconfig_interface_id), | 80 fontconfig_interface_id_(fontconfig_interface_id), |
81 ttc_index_(ttc_index) {} | 81 ttc_index_(ttc_index) {} |
82 | 82 |
83 FontFaceCreationType CreationType() const { return creation_type_; } | 83 FontFaceCreationType CreationType() const { return creation_type_; } |
84 AtomicString Family() const { | 84 AtomicString Family() const { |
85 ASSERT(creation_type_ == kCreateFontByFamily); | 85 DCHECK_EQ(creation_type_, kCreateFontByFamily); |
86 return family_; | 86 return family_; |
87 } | 87 } |
88 CString Filename() const { | 88 CString Filename() const { |
89 ASSERT(creation_type_ == kCreateFontByFciIdAndTtcIndex); | 89 DCHECK_EQ(creation_type_, kCreateFontByFciIdAndTtcIndex); |
90 return filename_; | 90 return filename_; |
91 } | 91 } |
92 int FontconfigInterfaceId() const { | 92 int FontconfigInterfaceId() const { |
93 ASSERT(creation_type_ == kCreateFontByFciIdAndTtcIndex); | 93 DCHECK_EQ(creation_type_, kCreateFontByFciIdAndTtcIndex); |
94 return fontconfig_interface_id_; | 94 return fontconfig_interface_id_; |
95 } | 95 } |
96 int TtcIndex() const { | 96 int TtcIndex() const { |
97 ASSERT(creation_type_ == kCreateFontByFciIdAndTtcIndex); | 97 DCHECK_EQ(creation_type_, kCreateFontByFciIdAndTtcIndex); |
98 return ttc_index_; | 98 return ttc_index_; |
99 } | 99 } |
100 | 100 |
101 unsigned GetHash() const { | 101 unsigned GetHash() const { |
102 if (creation_type_ == kCreateFontByFciIdAndTtcIndex) { | 102 if (creation_type_ == kCreateFontByFciIdAndTtcIndex) { |
103 StringHasher hasher; | 103 StringHasher hasher; |
104 // Hashing the filename and ints in this way is sensitive to character | 104 // Hashing the filename and ints in this way is sensitive to character |
105 // encoding and endianness. However, since the hash is not transferred | 105 // encoding and endianness. However, since the hash is not transferred |
106 // over a network or permanently stored and only used for the runtime of | 106 // over a network or permanently stored and only used for the runtime of |
107 // Chromium, this is not a concern. | 107 // Chromium, this is not a concern. |
(...skipping 21 matching lines...) Expand all Loading... |
129 FontFaceCreationType creation_type_; | 129 FontFaceCreationType creation_type_; |
130 AtomicString family_; | 130 AtomicString family_; |
131 CString filename_; | 131 CString filename_; |
132 int fontconfig_interface_id_; | 132 int fontconfig_interface_id_; |
133 int ttc_index_; | 133 int ttc_index_; |
134 }; | 134 }; |
135 | 135 |
136 } // namespace blink | 136 } // namespace blink |
137 | 137 |
138 #endif // FontFaceCreationParams_h | 138 #endif // FontFaceCreationParams_h |
OLD | NEW |