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

Unified Diff: ui/gfx/platform_font_ios.mm

Issue 1819753003: Allow various font weights in gfx. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a lost comment and modify a render text unittest to not test black because of test env font con… Created 4 years, 7 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
« no previous file with comments | « ui/gfx/platform_font_ios.h ('k') | ui/gfx/platform_font_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/platform_font_ios.mm
diff --git a/ui/gfx/platform_font_ios.mm b/ui/gfx/platform_font_ios.mm
index c51b8cb7960673f1254b67d9e6adec7485b6cf39..a5e0336febe0519e14035c7f4536f23a9fdf86ed 100644
--- a/ui/gfx/platform_font_ios.mm
+++ b/ui/gfx/platform_font_ios.mm
@@ -21,7 +21,8 @@ namespace gfx {
PlatformFontIOS::PlatformFontIOS() {
font_size_ = [UIFont systemFontSize];
- style_ = gfx::Font::NORMAL;
+ style_ = Font::NORMAL;
+ weight_ = Font::Weight::NORMAL;
UIFont* system_font = [UIFont systemFontOfSize:font_size_];
font_name_ = base::SysNSStringToUTF8([system_font fontName]);
CalculateMetrics();
@@ -29,21 +30,23 @@ PlatformFontIOS::PlatformFontIOS() {
PlatformFontIOS::PlatformFontIOS(NativeFont native_font) {
std::string font_name = base::SysNSStringToUTF8([native_font fontName]);
- InitWithNameSizeAndStyle(font_name,
- [native_font pointSize],
- gfx::Font::NORMAL);
+ InitWithNameSizeAndStyle(font_name, [native_font pointSize],
+ Font::NORMAL, Font::Weight::NORMAL);
}
-PlatformFontIOS::PlatformFontIOS(const std::string& font_name,
- int font_size) {
- InitWithNameSizeAndStyle(font_name, font_size, gfx::Font::NORMAL);
+PlatformFontIOS::PlatformFontIOS(const std::string& font_name, int font_size) {
+ InitWithNameSizeAndStyle(font_name, font_size, Font::NORMAL,
+ Font::Weight::NORMAL);
}
////////////////////////////////////////////////////////////////////////////////
// PlatformFontIOS, PlatformFont implementation:
-Font PlatformFontIOS::DeriveFont(int size_delta, int style) const {
- return Font(new PlatformFontIOS(font_name_, font_size_ + size_delta, style));
+Font PlatformFontIOS::DeriveFont(int size_delta,
+ int style,
+ Font::Weight weight) const {
+ return Font(
+ new PlatformFontIOS(font_name_, font_size_ + size_delta, style, weight));
}
int PlatformFontIOS::GetHeight() {
@@ -66,6 +69,10 @@ int PlatformFontIOS::GetStyle() const {
return style_;
}
+Font::Weight PlatformFontIOS::GetWeight() const {
+ return weight_;
+}
+
const std::string& PlatformFontIOS::GetFontName() const {
return font_name_;
}
@@ -94,16 +101,19 @@ NativeFont PlatformFontIOS::GetNativeFont() const {
PlatformFontIOS::PlatformFontIOS(const std::string& font_name,
int font_size,
- int style) {
- InitWithNameSizeAndStyle(font_name, font_size, style);
+ int style,
+ Font::Weight weight) {
+ InitWithNameSizeAndStyle(font_name, font_size, style, weight);
}
void PlatformFontIOS::InitWithNameSizeAndStyle(const std::string& font_name,
int font_size,
- int style) {
+ int style,
+ Font::Weight weight) {
font_name_ = font_name;
font_size_ = font_size;
style_ = style;
+ weight_ = weight;
CalculateMetrics();
}
« no previous file with comments | « ui/gfx/platform_font_ios.h ('k') | ui/gfx/platform_font_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698