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

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: Address Alexei's issues Created 4 years, 8 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
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..350191b1a5d30d3fba806da0d8a9829392d3584f 100644
--- a/ui/gfx/platform_font_ios.mm
+++ b/ui/gfx/platform_font_ios.mm
@@ -22,6 +22,7 @@ namespace gfx {
PlatformFontIOS::PlatformFontIOS() {
font_size_ = [UIFont systemFontSize];
style_ = gfx::Font::NORMAL;
+ weight_ = gfx::Font::Weight::NORMAL;
Alexei Svitkine (slow) 2016/04/05 16:38:52 Remove gfx::
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],
+ gfx::Font::NORMAL, gfx::Font::Weight::NORMAL);
Alexei Svitkine (slow) 2016/04/05 16:38:52 Remove gfx::
}
-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, gfx::Font::NORMAL,
+ gfx::Font::Weight::NORMAL);
Alexei Svitkine (slow) 2016/04/05 16:38:52 Remove gfx::
}
////////////////////////////////////////////////////////////////////////////////
// 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,
+ gfx::Font::Weight weight) const {
Alexei Svitkine (slow) 2016/04/05 16:38:51 Remove gfx::
+ 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_;
}
+gfx::Font::Weight PlatformFontIOS::GetWeight() const {
Alexei Svitkine (slow) 2016/04/05 16:38:52 Remove gfx::
+ 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,
+ gfx::Font::Weight weight) {
Alexei Svitkine (slow) 2016/04/05 16:38:52 Remove gfx::
+ InitWithNameSizeAndStyle(font_name, font_size, style, weight);
}
void PlatformFontIOS::InitWithNameSizeAndStyle(const std::string& font_name,
int font_size,
- int style) {
+ int style,
+ gfx::Font::Weight weight) {
Alexei Svitkine (slow) 2016/04/05 16:38:52 Remove gfx::
font_name_ = font_name;
font_size_ = font_size;
style_ = style;
+ weight_ = weight;
CalculateMetrics();
}

Powered by Google App Engine
This is Rietveld 408576698