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

Unified Diff: include/core/SkFont.h

Issue 185293018: WIP -- SkFont (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: new take on flags Created 6 years, 9 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 | « gyp/core.gypi ('k') | src/core/SkFont.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkFont.h
diff --git a/include/core/SkFont.h b/include/core/SkFont.h
new file mode 100644
index 0000000000000000000000000000000000000000..7a09f82c393d7d5d256b054277d8cb13076fbbfd
--- /dev/null
+++ b/include/core/SkFont.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkRefCnt.h"
+#include "SkScalar.h"
+
+class SkTypeface;
+
+enum SkTextEncoding {
+ kUTF8_SkTextEncoding,
+ kUTF16_SkTextEncoding,
+ kUTF32_SkTextEncoding,
+ kGlyphID_SkTextEncoding,
+};
+
+class SkFont : public SkRefCnt {
+public:
+ enum Flags {
bungeman-skia 2014/03/25 19:51:45 Should requests for synthetics go here (fake bold)
+ kAutoHint_Flag = 1 << 0,
+ kByteCodeHint_Flag = 1 << 1,
+ kGridAlignMetrics_Flag = 1 << 2,
bungeman-skia 2014/03/25 19:51:45 These three bits are awesome, but I almost want a
+ kVertical_Flag = 1 << 3,
+ kEmbeddedBitmaps_Flag = 1 << 4,
+ kGenA8FromLCD_Flag = 1 << 5,
+ kLCD_Mask_Flag = 1 << 6,
+ };
+ uint32_t getFlags() const { return fFlags; }
+
+ SkTypeface* getTypeface() const { return fTypeface; }
+ SkScalar getSize() const { return fSize; }
+ SkScalar getScaleX() const { return fScaleX; }
+ SkScalar getSkewX() const { return fSkewX; }
+
+ int textToGlyphs(const void* text, size_t byteLength, SkTextEncoding,
+ uint16_t glyphs[], int maxGlyphCount) const;
+
+ SkScalar measureText(const void* text, size_t byteLength, SkTextEncoding) const;
+
+private:
+ virtual ~SkFont();
+
+ SkTypeface* fTypeface;
+ SkScalar fScale;
+ SkScalar fScaleX;
+ SkScalar fSkewX;
+ uint32_t fFlags;
+};
+
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkFont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698