Commit d8fc0811 authored by bauerb's avatar bauerb Committed by Commit bot

[Android] Specify compositor tab title size in scaled pixels.

This lets Resources do the size calculations, and also fixes an issue where the
font scaling factor would be applied twice for >600dp screens
(chrome/android/java/res/values-sw600dp/dimens.xml already specifies the size
in sp).

Review-Url: https://codereview.chromium.org/2033683002
Cr-Commit-Position: refs/heads/master@{#398283}
parent 53803cd4
......@@ -137,7 +137,7 @@
<dimen name="compositor_tab_title_bar_shadow_x_offset_incognito">-0.6667dp</dimen> <!-- -1px hdpi -->
<dimen name="compositor_tab_title_bar_shadow_y_offset_incognito">-0.6667dp</dimen> <!-- -1px hdpi -->
<!-- The size of the text for tab titles. -->
<dimen name="compositor_tab_title_text_size">13dp</dimen>
<dimen name="compositor_tab_title_text_size">13sp</dimen>
<!-- The size of the bounding box for favicons. -->
<dimen name="compositor_tab_title_favicon_size">16dp</dimen>
<!-- Slop value for allowing slight misses on the compositor button. -->
......
......@@ -62,8 +62,7 @@ public class TitleBitmapFactory {
int shadowYOffset = res.getDimensionPixelOffset(incognito
? R.dimen.compositor_tab_title_bar_shadow_y_offset_incognito
: R.dimen.compositor_tab_title_bar_shadow_y_offset);
float textSize = res.getDimensionPixelSize(R.dimen.compositor_tab_title_text_size);
float adjustedTextSize = textSize * res.getConfiguration().fontScale;
float textSize = res.getDimension(R.dimen.compositor_tab_title_text_size);
boolean fakeBoldText = res.getBoolean(R.bool.compositor_tab_title_fake_bold_text);
......@@ -72,7 +71,7 @@ public class TitleBitmapFactory {
if (shadowXOffset != 0 && shadowYOffset != 0) {
mTextPaint.setShadowLayer(0.001f, shadowXOffset, shadowYOffset, shadowColor);
}
mTextPaint.setTextSize(adjustedTextSize);
mTextPaint.setTextSize(textSize);
mTextPaint.setFakeBoldText(fakeBoldText);
mTextPaint.density = res.getDisplayMetrics().density;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment