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

Unified Diff: src/core/SkFontStyle.cpp

Issue 799533004: Move SkFontMgr and SkFontStyle impls to own cpp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: The header is elsewhere... Created 5 years, 11 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 | « src/core/SkFontMgr.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkFontStyle.cpp
diff --git a/src/core/SkFontStyle.cpp b/src/core/SkFontStyle.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..285d17a2b0ec70b6eae8180fa8d9430f59041a48
--- /dev/null
+++ b/src/core/SkFontStyle.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkFontStyle.h"
+#include "SkTypeface.h"
+#include "SkTypes.h"
+
+SkFontStyle::SkFontStyle() {
+ fUnion.fU32 = 0;
+ fUnion.fR.fWeight = kNormal_Weight;
+ fUnion.fR.fWidth = kNormal_Width;
+ fUnion.fR.fSlant = kUpright_Slant;
+}
+
+SkFontStyle::SkFontStyle(int weight, int width, Slant slant) {
+ fUnion.fU32 = 0;
+ fUnion.fR.fWeight = SkPin32(weight, kThin_Weight, kBlack_Weight);
+ fUnion.fR.fWidth = SkPin32(width, kUltraCondensed_Width, kUltaExpanded_Width);
+ fUnion.fR.fSlant = SkPin32(slant, kUpright_Slant, kItalic_Slant);
+}
+
+SkFontStyle::SkFontStyle(unsigned oldStyle) {
+ fUnion.fU32 = 0;
+ fUnion.fR.fWeight = (oldStyle & SkTypeface::kBold) ? SkFontStyle::kBold_Weight
+ : SkFontStyle::kNormal_Weight;
+ fUnion.fR.fWidth = SkFontStyle::kNormal_Width;
+ fUnion.fR.fSlant = (oldStyle & SkTypeface::kItalic) ? SkFontStyle::kItalic_Slant
+ : SkFontStyle::kUpright_Slant;
+}
« no previous file with comments | « src/core/SkFontMgr.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698