| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/font_render_params.h" | 5 #include "ui/gfx/font_render_params.h" |
| 6 | 6 |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 CreateFontconfigEditStanza("antialias", "bool", "false") + | 100 CreateFontconfigEditStanza("antialias", "bool", "false") + |
| 101 kFontconfigMatchFooter + | 101 kFontconfigMatchFooter + |
| 102 kFontconfigMatchFontHeader + | 102 kFontconfigMatchFontHeader + |
| 103 CreateFontconfigTestStanza("pixel_size", "more_eq", "double", "10.0") + | 103 CreateFontconfigTestStanza("pixel_size", "more_eq", "double", "10.0") + |
| 104 CreateFontconfigTestStanza("pixel_size", "less_eq", "double", "20.0") + | 104 CreateFontconfigTestStanza("pixel_size", "less_eq", "double", "20.0") + |
| 105 CreateFontconfigEditStanza("antialias", "bool", "false") + | 105 CreateFontconfigEditStanza("antialias", "bool", "false") + |
| 106 kFontconfigMatchFooter + | 106 kFontconfigMatchFooter + |
| 107 kFontconfigFileFooter)); | 107 kFontconfigFileFooter)); |
| 108 | 108 |
| 109 FontRenderParams params = GetFontRenderParams( | 109 FontRenderParams params = GetFontRenderParams( |
| 110 FontRenderParamsQuery(true), NULL); | 110 FontRenderParamsQuery(), NULL); |
| 111 EXPECT_TRUE(params.antialiasing); | 111 EXPECT_TRUE(params.antialiasing); |
| 112 EXPECT_TRUE(params.autohinter); | 112 EXPECT_TRUE(params.autohinter); |
| 113 EXPECT_TRUE(params.use_bitmaps); | 113 EXPECT_TRUE(params.use_bitmaps); |
| 114 EXPECT_EQ(FontRenderParams::HINTING_SLIGHT, params.hinting); | 114 EXPECT_EQ(FontRenderParams::HINTING_SLIGHT, params.hinting); |
| 115 EXPECT_FALSE(params.subpixel_positioning); | 115 EXPECT_FALSE(params.subpixel_positioning); |
| 116 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_RGB, | 116 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_RGB, |
| 117 params.subpixel_rendering); | 117 params.subpixel_rendering); |
| 118 } | 118 } |
| 119 | 119 |
| 120 TEST_F(FontRenderParamsTest, Size) { | 120 TEST_F(FontRenderParamsTest, Size) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 133 kFontconfigMatchFooter + | 133 kFontconfigMatchFooter + |
| 134 kFontconfigMatchPatternHeader + | 134 kFontconfigMatchPatternHeader + |
| 135 CreateFontconfigTestStanza("size", "more_eq", "double", "20") + | 135 CreateFontconfigTestStanza("size", "more_eq", "double", "20") + |
| 136 CreateFontconfigEditStanza("hintstyle", "const", "hintslight") + | 136 CreateFontconfigEditStanza("hintstyle", "const", "hintslight") + |
| 137 CreateFontconfigEditStanza("rgba", "const", "rgb") + | 137 CreateFontconfigEditStanza("rgba", "const", "rgb") + |
| 138 kFontconfigMatchFooter + | 138 kFontconfigMatchFooter + |
| 139 kFontconfigFileFooter)); | 139 kFontconfigFileFooter)); |
| 140 | 140 |
| 141 // The defaults should be used when the supplied size isn't matched by the | 141 // The defaults should be used when the supplied size isn't matched by the |
| 142 // second or third blocks. | 142 // second or third blocks. |
| 143 FontRenderParamsQuery query(false); | 143 FontRenderParamsQuery query; |
| 144 query.pixel_size = 12; | 144 query.pixel_size = 12; |
| 145 FontRenderParams params = GetFontRenderParams(query, NULL); | 145 FontRenderParams params = GetFontRenderParams(query, NULL); |
| 146 EXPECT_TRUE(params.antialiasing); | 146 EXPECT_TRUE(params.antialiasing); |
| 147 EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting); | 147 EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting); |
| 148 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE, | 148 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE, |
| 149 params.subpixel_rendering); | 149 params.subpixel_rendering); |
| 150 | 150 |
| 151 query.pixel_size = 10; | 151 query.pixel_size = 10; |
| 152 params = GetFontRenderParams(query, NULL); | 152 params = GetFontRenderParams(query, NULL); |
| 153 EXPECT_FALSE(params.antialiasing); | 153 EXPECT_FALSE(params.antialiasing); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 179 kFontconfigMatchPatternHeader + | 179 kFontconfigMatchPatternHeader + |
| 180 CreateFontconfigTestStanza("weight", "eq", "const", "bold") + | 180 CreateFontconfigTestStanza("weight", "eq", "const", "bold") + |
| 181 CreateFontconfigEditStanza("rgba", "const", "none") + | 181 CreateFontconfigEditStanza("rgba", "const", "none") + |
| 182 kFontconfigMatchFooter + | 182 kFontconfigMatchFooter + |
| 183 kFontconfigMatchPatternHeader + | 183 kFontconfigMatchPatternHeader + |
| 184 CreateFontconfigTestStanza("slant", "eq", "const", "italic") + | 184 CreateFontconfigTestStanza("slant", "eq", "const", "italic") + |
| 185 CreateFontconfigEditStanza("hinting", "bool", "false") + | 185 CreateFontconfigEditStanza("hinting", "bool", "false") + |
| 186 kFontconfigMatchFooter + | 186 kFontconfigMatchFooter + |
| 187 kFontconfigFileFooter)); | 187 kFontconfigFileFooter)); |
| 188 | 188 |
| 189 FontRenderParamsQuery query(false); | 189 FontRenderParamsQuery query; |
| 190 query.style = Font::NORMAL; | 190 query.style = Font::NORMAL; |
| 191 FontRenderParams params = GetFontRenderParams(query, NULL); | 191 FontRenderParams params = GetFontRenderParams(query, NULL); |
| 192 EXPECT_EQ(FontRenderParams::HINTING_SLIGHT, params.hinting); | 192 EXPECT_EQ(FontRenderParams::HINTING_SLIGHT, params.hinting); |
| 193 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_RGB, | 193 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_RGB, |
| 194 params.subpixel_rendering); | 194 params.subpixel_rendering); |
| 195 | 195 |
| 196 query.style = Font::BOLD; | 196 query.style = Font::BOLD; |
| 197 params = GetFontRenderParams(query, NULL); | 197 params = GetFontRenderParams(query, NULL); |
| 198 EXPECT_EQ(FontRenderParams::HINTING_SLIGHT, params.hinting); | 198 EXPECT_EQ(FontRenderParams::HINTING_SLIGHT, params.hinting); |
| 199 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE, | 199 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 220 CreateFontconfigEditStanza("antialias", "bool", "false") + | 220 CreateFontconfigEditStanza("antialias", "bool", "false") + |
| 221 kFontconfigMatchFooter + | 221 kFontconfigMatchFooter + |
| 222 kFontconfigMatchPatternHeader + | 222 kFontconfigMatchPatternHeader + |
| 223 CreateFontconfigTestStanza("scalable", "eq", "bool", "true") + | 223 CreateFontconfigTestStanza("scalable", "eq", "bool", "true") + |
| 224 CreateFontconfigEditStanza("antialias", "bool", "true") + | 224 CreateFontconfigEditStanza("antialias", "bool", "true") + |
| 225 kFontconfigMatchFooter + | 225 kFontconfigMatchFooter + |
| 226 kFontconfigFileFooter)); | 226 kFontconfigFileFooter)); |
| 227 | 227 |
| 228 // Check that we specifically ask how scalable fonts should be rendered. | 228 // Check that we specifically ask how scalable fonts should be rendered. |
| 229 FontRenderParams params = GetFontRenderParams( | 229 FontRenderParams params = GetFontRenderParams( |
| 230 FontRenderParamsQuery(false), NULL); | 230 FontRenderParamsQuery(), NULL); |
| 231 EXPECT_TRUE(params.antialiasing); | 231 EXPECT_TRUE(params.antialiasing); |
| 232 } | 232 } |
| 233 | 233 |
| 234 TEST_F(FontRenderParamsTest, UseBitmaps) { | 234 TEST_F(FontRenderParamsTest, UseBitmaps) { |
| 235 ASSERT_TRUE(LoadSystemFontIntoFontconfig("arial.ttf")); | 235 ASSERT_TRUE(LoadSystemFontIntoFontconfig("arial.ttf")); |
| 236 // Load a config that enables embedded bitmaps for fonts <= 10 pixels. | 236 // Load a config that enables embedded bitmaps for fonts <= 10 pixels. |
| 237 ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(), | 237 ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(), |
| 238 std::string(kFontconfigFileHeader) + | 238 std::string(kFontconfigFileHeader) + |
| 239 kFontconfigMatchPatternHeader + | 239 kFontconfigMatchPatternHeader + |
| 240 CreateFontconfigEditStanza("embeddedbitmap", "bool", "false") + | 240 CreateFontconfigEditStanza("embeddedbitmap", "bool", "false") + |
| 241 kFontconfigMatchFooter + | 241 kFontconfigMatchFooter + |
| 242 kFontconfigMatchPatternHeader + | 242 kFontconfigMatchPatternHeader + |
| 243 CreateFontconfigTestStanza("pixelsize", "less_eq", "double", "10") + | 243 CreateFontconfigTestStanza("pixelsize", "less_eq", "double", "10") + |
| 244 CreateFontconfigEditStanza("embeddedbitmap", "bool", "true") + | 244 CreateFontconfigEditStanza("embeddedbitmap", "bool", "true") + |
| 245 kFontconfigMatchFooter + | 245 kFontconfigMatchFooter + |
| 246 kFontconfigFileFooter)); | 246 kFontconfigFileFooter)); |
| 247 | 247 |
| 248 FontRenderParamsQuery query(false); | 248 FontRenderParamsQuery query; |
| 249 FontRenderParams params = GetFontRenderParams(query, NULL); | 249 FontRenderParams params = GetFontRenderParams(query, NULL); |
| 250 EXPECT_FALSE(params.use_bitmaps); | 250 EXPECT_FALSE(params.use_bitmaps); |
| 251 | 251 |
| 252 query.pixel_size = 5; | 252 query.pixel_size = 5; |
| 253 params = GetFontRenderParams(query, NULL); | 253 params = GetFontRenderParams(query, NULL); |
| 254 EXPECT_TRUE(params.use_bitmaps); | 254 EXPECT_TRUE(params.use_bitmaps); |
| 255 } | 255 } |
| 256 | 256 |
| 257 TEST_F(FontRenderParamsTest, ForceFullHintingWhenAntialiasingIsDisabled) { | 257 TEST_F(FontRenderParamsTest, ForceFullHintingWhenAntialiasingIsDisabled) { |
| 258 // Load a config that disables antialiasing and hinting while requesting | 258 // Load a config that disables antialiasing and hinting while requesting |
| 259 // subpixel rendering. | 259 // subpixel rendering. |
| 260 ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(), | 260 ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(), |
| 261 std::string(kFontconfigFileHeader) + | 261 std::string(kFontconfigFileHeader) + |
| 262 kFontconfigMatchPatternHeader + | 262 kFontconfigMatchPatternHeader + |
| 263 CreateFontconfigEditStanza("antialias", "bool", "false") + | 263 CreateFontconfigEditStanza("antialias", "bool", "false") + |
| 264 CreateFontconfigEditStanza("hinting", "bool", "false") + | 264 CreateFontconfigEditStanza("hinting", "bool", "false") + |
| 265 CreateFontconfigEditStanza("hintstyle", "const", "hintnone") + | 265 CreateFontconfigEditStanza("hintstyle", "const", "hintnone") + |
| 266 CreateFontconfigEditStanza("rgba", "const", "rgb") + | 266 CreateFontconfigEditStanza("rgba", "const", "rgb") + |
| 267 kFontconfigMatchFooter + | 267 kFontconfigMatchFooter + |
| 268 kFontconfigFileFooter)); | 268 kFontconfigFileFooter)); |
| 269 | 269 |
| 270 // Full hinting should be forced. See the comment in GetFontRenderParams() for | 270 // Full hinting should be forced. See the comment in GetFontRenderParams() for |
| 271 // more information. | 271 // more information. |
| 272 FontRenderParams params = GetFontRenderParams( | 272 FontRenderParams params = GetFontRenderParams( |
| 273 FontRenderParamsQuery(false), NULL); | 273 FontRenderParamsQuery(), NULL); |
| 274 EXPECT_FALSE(params.antialiasing); | 274 EXPECT_FALSE(params.antialiasing); |
| 275 EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting); | 275 EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting); |
| 276 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE, | 276 EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE, |
| 277 params.subpixel_rendering); | 277 params.subpixel_rendering); |
| 278 EXPECT_FALSE(params.subpixel_positioning); | 278 EXPECT_FALSE(params.subpixel_positioning); |
| 279 } | 279 } |
| 280 | 280 |
| 281 #if defined(OS_CHROMEOS) | 281 #if defined(OS_CHROMEOS) |
| 282 TEST_F(FontRenderParamsTest, ForceSubpixelPositioning) { | 282 TEST_F(FontRenderParamsTest, ForceSubpixelPositioning) { |
| 283 { | 283 { |
| 284 FontRenderParams params = | 284 FontRenderParams params = |
| 285 GetFontRenderParams(FontRenderParamsQuery(false), NULL); | 285 GetFontRenderParams(FontRenderParamsQuery(), NULL); |
| 286 EXPECT_TRUE(params.antialiasing); | 286 EXPECT_TRUE(params.antialiasing); |
| 287 EXPECT_FALSE(params.subpixel_positioning); | 287 EXPECT_FALSE(params.subpixel_positioning); |
| 288 SetFontRenderParamsDeviceScaleFactor(1.0f); | 288 SetFontRenderParamsDeviceScaleFactor(1.0f); |
| 289 } | 289 } |
| 290 ClearFontRenderParamsCacheForTest(); | 290 ClearFontRenderParamsCacheForTest(); |
| 291 SetFontRenderParamsDeviceScaleFactor(1.25f); | 291 SetFontRenderParamsDeviceScaleFactor(1.25f); |
| 292 // Subpixel positioning should be forced. | 292 // Subpixel positioning should be forced. |
| 293 { | 293 { |
| 294 FontRenderParams params = | 294 FontRenderParams params = |
| 295 GetFontRenderParams(FontRenderParamsQuery(false), NULL); | 295 GetFontRenderParams(FontRenderParamsQuery(), NULL); |
| 296 EXPECT_TRUE(params.antialiasing); | 296 EXPECT_TRUE(params.antialiasing); |
| 297 EXPECT_TRUE(params.subpixel_positioning); | 297 EXPECT_TRUE(params.subpixel_positioning); |
| 298 SetFontRenderParamsDeviceScaleFactor(1.0f); | 298 SetFontRenderParamsDeviceScaleFactor(1.0f); |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 #endif | 301 #endif |
| 302 | 302 |
| 303 TEST_F(FontRenderParamsTest, OnlySetConfiguredValues) { | 303 TEST_F(FontRenderParamsTest, OnlySetConfiguredValues) { |
| 304 // Configure the LinuxFontDelegate (which queries GtkSettings on desktop | 304 // Configure the LinuxFontDelegate (which queries GtkSettings on desktop |
| 305 // Linux) to request subpixel rendering. | 305 // Linux) to request subpixel rendering. |
| 306 FontRenderParams system_params; | 306 FontRenderParams system_params; |
| 307 system_params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_RGB; | 307 system_params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_RGB; |
| 308 test_font_delegate_.set_params(system_params); | 308 test_font_delegate_.set_params(system_params); |
| 309 | 309 |
| 310 // Load a Fontconfig config that enables antialiasing but doesn't say anything | 310 // Load a Fontconfig config that enables antialiasing but doesn't say anything |
| 311 // about subpixel rendering. | 311 // about subpixel rendering. |
| 312 ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(), | 312 ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(), |
| 313 std::string(kFontconfigFileHeader) + | 313 std::string(kFontconfigFileHeader) + |
| 314 kFontconfigMatchPatternHeader + | 314 kFontconfigMatchPatternHeader + |
| 315 CreateFontconfigEditStanza("antialias", "bool", "true") + | 315 CreateFontconfigEditStanza("antialias", "bool", "true") + |
| 316 kFontconfigMatchFooter + | 316 kFontconfigMatchFooter + |
| 317 kFontconfigFileFooter)); | 317 kFontconfigFileFooter)); |
| 318 | 318 |
| 319 // The subpixel rendering setting from the delegate should make it through. | 319 // The subpixel rendering setting from the delegate should make it through. |
| 320 FontRenderParams params = GetFontRenderParams( | 320 FontRenderParams params = GetFontRenderParams( |
| 321 FontRenderParamsQuery(false), NULL); | 321 FontRenderParamsQuery(), NULL); |
| 322 EXPECT_EQ(system_params.subpixel_rendering, params.subpixel_rendering); | 322 EXPECT_EQ(system_params.subpixel_rendering, params.subpixel_rendering); |
| 323 } | 323 } |
| 324 | 324 |
| 325 TEST_F(FontRenderParamsTest, NoFontconfigMatch) { | 325 TEST_F(FontRenderParamsTest, NoFontconfigMatch) { |
| 326 // Don't load a Fontconfig configuration. | 326 // Don't load a Fontconfig configuration. |
| 327 FontRenderParams system_params; | 327 FontRenderParams system_params; |
| 328 system_params.antialiasing = true; | 328 system_params.antialiasing = true; |
| 329 system_params.hinting = FontRenderParams::HINTING_MEDIUM; | 329 system_params.hinting = FontRenderParams::HINTING_MEDIUM; |
| 330 system_params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_RGB; | 330 system_params.subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_RGB; |
| 331 test_font_delegate_.set_params(system_params); | 331 test_font_delegate_.set_params(system_params); |
| 332 | 332 |
| 333 FontRenderParamsQuery query(false); | 333 FontRenderParamsQuery query; |
| 334 query.families.push_back("Arial"); | 334 query.families.push_back("Arial"); |
| 335 query.families.push_back("Times New Roman"); | 335 query.families.push_back("Times New Roman"); |
| 336 query.pixel_size = 10; | 336 query.pixel_size = 10; |
| 337 std::string suggested_family; | 337 std::string suggested_family; |
| 338 FontRenderParams params = GetFontRenderParams(query, &suggested_family); | 338 FontRenderParams params = GetFontRenderParams(query, &suggested_family); |
| 339 | 339 |
| 340 // The system params and the first requested family should be returned. | 340 // The system params and the first requested family should be returned. |
| 341 EXPECT_EQ(system_params.antialiasing, params.antialiasing); | 341 EXPECT_EQ(system_params.antialiasing, params.antialiasing); |
| 342 EXPECT_EQ(system_params.hinting, params.hinting); | 342 EXPECT_EQ(system_params.hinting, params.hinting); |
| 343 EXPECT_EQ(system_params.subpixel_rendering, params.subpixel_rendering); | 343 EXPECT_EQ(system_params.subpixel_rendering, params.subpixel_rendering); |
| 344 EXPECT_EQ(query.families[0], suggested_family); | 344 EXPECT_EQ(query.families[0], suggested_family); |
| 345 } | 345 } |
| 346 | 346 |
| 347 TEST_F(FontRenderParamsTest, MissingFamily) { | 347 TEST_F(FontRenderParamsTest, MissingFamily) { |
| 348 // With Arial and Verdana installed, request (in order) Helvetica, Arial, and | 348 // With Arial and Verdana installed, request (in order) Helvetica, Arial, and |
| 349 // Verdana and check that Arial is returned. | 349 // Verdana and check that Arial is returned. |
| 350 ASSERT_TRUE(LoadSystemFontIntoFontconfig("arial.ttf")); | 350 ASSERT_TRUE(LoadSystemFontIntoFontconfig("arial.ttf")); |
| 351 ASSERT_TRUE(LoadSystemFontIntoFontconfig("verdana.ttf")); | 351 ASSERT_TRUE(LoadSystemFontIntoFontconfig("verdana.ttf")); |
| 352 FontRenderParamsQuery query(false); | 352 FontRenderParamsQuery query; |
| 353 query.families.push_back("Helvetica"); | 353 query.families.push_back("Helvetica"); |
| 354 query.families.push_back("Arial"); | 354 query.families.push_back("Arial"); |
| 355 query.families.push_back("Verdana"); | 355 query.families.push_back("Verdana"); |
| 356 std::string suggested_family; | 356 std::string suggested_family; |
| 357 GetFontRenderParams(query, &suggested_family); | 357 GetFontRenderParams(query, &suggested_family); |
| 358 EXPECT_EQ("Arial", suggested_family); | 358 EXPECT_EQ("Arial", suggested_family); |
| 359 } | 359 } |
| 360 | 360 |
| 361 TEST_F(FontRenderParamsTest, SubstituteFamily) { | 361 TEST_F(FontRenderParamsTest, SubstituteFamily) { |
| 362 // Configure Fontconfig to use Verdana for both Helvetica and Arial. | 362 // Configure Fontconfig to use Verdana for both Helvetica and Arial. |
| 363 ASSERT_TRUE(LoadSystemFontIntoFontconfig("arial.ttf")); | 363 ASSERT_TRUE(LoadSystemFontIntoFontconfig("arial.ttf")); |
| 364 ASSERT_TRUE(LoadSystemFontIntoFontconfig("verdana.ttf")); | 364 ASSERT_TRUE(LoadSystemFontIntoFontconfig("verdana.ttf")); |
| 365 ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(), | 365 ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(), |
| 366 std::string(kFontconfigFileHeader) + | 366 std::string(kFontconfigFileHeader) + |
| 367 CreateFontconfigAliasStanza("Helvetica", "Verdana") + | 367 CreateFontconfigAliasStanza("Helvetica", "Verdana") + |
| 368 kFontconfigMatchPatternHeader + | 368 kFontconfigMatchPatternHeader + |
| 369 CreateFontconfigTestStanza("family", "eq", "string", "Arial") + | 369 CreateFontconfigTestStanza("family", "eq", "string", "Arial") + |
| 370 CreateFontconfigEditStanza("family", "string", "Verdana") + | 370 CreateFontconfigEditStanza("family", "string", "Verdana") + |
| 371 kFontconfigMatchFooter + | 371 kFontconfigMatchFooter + |
| 372 kFontconfigFileFooter)); | 372 kFontconfigFileFooter)); |
| 373 | 373 |
| 374 FontRenderParamsQuery query(false); | 374 FontRenderParamsQuery query; |
| 375 query.families.push_back("Helvetica"); | 375 query.families.push_back("Helvetica"); |
| 376 std::string suggested_family; | 376 std::string suggested_family; |
| 377 GetFontRenderParams(query, &suggested_family); | 377 GetFontRenderParams(query, &suggested_family); |
| 378 EXPECT_EQ("Verdana", suggested_family); | 378 EXPECT_EQ("Verdana", suggested_family); |
| 379 | 379 |
| 380 query.families.clear(); | 380 query.families.clear(); |
| 381 query.families.push_back("Arial"); | 381 query.families.push_back("Arial"); |
| 382 suggested_family.clear(); | 382 suggested_family.clear(); |
| 383 GetFontRenderParams(query, &suggested_family); | 383 GetFontRenderParams(query, &suggested_family); |
| 384 EXPECT_EQ("Verdana", suggested_family); | 384 EXPECT_EQ("Verdana", suggested_family); |
| 385 } | 385 } |
| 386 | 386 |
| 387 } // namespace gfx | 387 } // namespace gfx |
| OLD | NEW |