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

Unified Diff: ui/gfx/font_render_params_linux_unittest.cc

Issue 417003002: linux: Force full hinting when antialiasing is disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« ui/gfx/font_render_params_linux.cc ('K') | « ui/gfx/font_render_params_linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/font_render_params_linux_unittest.cc
diff --git a/ui/gfx/font_render_params_linux_unittest.cc b/ui/gfx/font_render_params_linux_unittest.cc
index a7924833234db3646a4808c978e956041878191d..af1e0821b8f1012be9724e8f90756cd08cb3d712 100644
--- a/ui/gfx/font_render_params_linux_unittest.cc
+++ b/ui/gfx/font_render_params_linux_unittest.cc
@@ -158,22 +158,23 @@ TEST_F(FontRenderParamsTest, Size) {
TEST_F(FontRenderParamsTest, Style) {
ASSERT_TRUE(LoadSystemFont("arial.ttf"));
- // Load a config that disables antialiasing for bold text and disables
- // hinting for italic text.
+ // Load a config that disables hinting for bold text and disables subpixel
+ // rendering for italic text.
ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(),
std::string(kFontconfigFileHeader) +
kFontconfigMatchHeader +
CreateFontconfigEditStanza("antialias", "bool", "true") +
msw 2014/07/24 22:25:43 nit: remove the antialias setting and checks below
Daniel Erat 2014/07/24 22:52:01 i'll remove the checks, but i believe that setting
msw 2014/07/24 22:58:25 Acknowledged.
CreateFontconfigEditStanza("hinting", "bool", "true") +
- CreateFontconfigEditStanza("hintstyle", "const", "hintfull") +
+ CreateFontconfigEditStanza("hintstyle", "const", "hintslight") +
+ CreateFontconfigEditStanza("rgba", "const", "rgb") +
kFontconfigMatchFooter +
kFontconfigMatchHeader +
CreateFontconfigTestStanza("weight", "eq", "const", "bold") +
- CreateFontconfigEditStanza("antialias", "bool", "false") +
+ CreateFontconfigEditStanza("hinting", "bool", "false") +
msw 2014/07/24 22:25:43 optional nit: continue disabling hinting for itali
Daniel Erat 2014/07/24 22:52:01 Done.
kFontconfigMatchFooter +
kFontconfigMatchHeader +
CreateFontconfigTestStanza("slant", "eq", "const", "italic") +
- CreateFontconfigEditStanza("hinting", "bool", "false") +
+ CreateFontconfigEditStanza("rgba", "const", "none") +
kFontconfigMatchFooter +
kFontconfigFileFooter));
@@ -181,22 +182,30 @@ TEST_F(FontRenderParamsTest, Style) {
query.style = Font::NORMAL;
FontRenderParams params = GetFontRenderParams(query, NULL);
EXPECT_TRUE(params.antialiasing);
- EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting);
+ EXPECT_EQ(FontRenderParams::HINTING_SLIGHT, params.hinting);
+ EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_RGB,
+ params.subpixel_rendering);
query.style = Font::BOLD;
params = GetFontRenderParams(query, NULL);
- EXPECT_FALSE(params.antialiasing);
- EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting);
+ EXPECT_TRUE(params.antialiasing);
+ EXPECT_EQ(FontRenderParams::HINTING_NONE, params.hinting);
+ EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_RGB,
+ params.subpixel_rendering);
query.style = Font::ITALIC;
params = GetFontRenderParams(query, NULL);
EXPECT_TRUE(params.antialiasing);
- EXPECT_EQ(FontRenderParams::HINTING_NONE, params.hinting);
+ EXPECT_EQ(FontRenderParams::HINTING_SLIGHT, params.hinting);
+ EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE,
+ params.subpixel_rendering);
query.style = Font::BOLD | Font::ITALIC;
params = GetFontRenderParams(query, NULL);
- EXPECT_FALSE(params.antialiasing);
+ EXPECT_TRUE(params.antialiasing);
EXPECT_EQ(FontRenderParams::HINTING_NONE, params.hinting);
+ EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE,
+ params.subpixel_rendering);
}
TEST_F(FontRenderParamsTest, Scalable) {
@@ -242,6 +251,30 @@ TEST_F(FontRenderParamsTest, UseBitmaps) {
EXPECT_TRUE(params.use_bitmaps);
}
+TEST_F(FontRenderParamsTest, ForceFullHintingWhenAntialiasingIsDisabled) {
+ // Load a config that disables antialiasing and hinting while requesting
+ // subpixel rendering.
+ ASSERT_TRUE(LoadSystemFont("arial.ttf"));
+ ASSERT_TRUE(LoadConfigDataIntoFontconfig(temp_dir_.path(),
+ std::string(kFontconfigFileHeader) +
+ kFontconfigMatchHeader +
+ CreateFontconfigEditStanza("antialias", "bool", "false") +
+ CreateFontconfigEditStanza("hinting", "bool", "false") +
+ CreateFontconfigEditStanza("hintstyle", "const", "hintnone") +
+ CreateFontconfigEditStanza("rgba", "const", "rgb") +
+ kFontconfigMatchFooter +
+ kFontconfigFileFooter));
+
+ // Full hinting should be forced.
msw 2014/07/24 22:25:44 optional nit: add "See the comment in GetFontRende
Daniel Erat 2014/07/24 22:52:00 Done.
+ FontRenderParams params = GetFontRenderParams(
+ FontRenderParamsQuery(false), NULL);
+ EXPECT_FALSE(params.antialiasing);
+ EXPECT_EQ(FontRenderParams::HINTING_FULL, params.hinting);
+ EXPECT_EQ(FontRenderParams::SUBPIXEL_RENDERING_NONE,
+ params.subpixel_rendering);
+ EXPECT_FALSE(params.subpixel_positioning);
+}
+
TEST_F(FontRenderParamsTest, OnlySetConfiguredValues) {
// Configure the LinuxFontDelegate (which queries GtkSettings on desktop
// Linux) to request subpixel rendering.
« ui/gfx/font_render_params_linux.cc ('K') | « ui/gfx/font_render_params_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698