diff options
author | vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2010-11-11 21:37:00 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2010-11-11 21:37:00 +0000 |
commit | 28be72b63e457c680c192a34fb9f58e1c693363f (patch) | |
tree | 4c092ef6116c3cf8a9b08d05d02762b7969f9288 /include/core | |
parent | 8c1d88dcfb978835779b6b5c5e7d1cbb78b6ca4d (diff) |
PDF: Add text support with a font framework (font embedding to come).
Supports fakeBold, underline, strikethrough, mode (fill, stroke, both), size, skew, alignment (left, center, right).
Missing is drawFontOnPath and font lookup and embedding.
Changed SkPDFString to support how it is used from drawText methods.
Moved compile assert into SkTypes.
Moved constants and utility function used to support fakeBold, underline, and strikethrough into higher level locations.
Review URL: http://codereview.appspot.com/2946041
git-svn-id: http://skia.googlecode.com/svn/trunk@624 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkPaint.h | 3 | ||||
-rw-r--r-- | include/core/SkScalar.h | 13 | ||||
-rw-r--r-- | include/core/SkTypes.h | 11 |
3 files changed, 26 insertions, 1 deletions
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 722bc5d851..16411d5886 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -863,9 +863,10 @@ private: enum { kCanonicalTextSizeForPaths = 64 }; + friend class SkAutoGlyphCache; friend class SkCanvas; friend class SkDraw; - friend class SkAutoGlyphCache; + friend class SkPDFDevice; friend class SkTextToPathIter; }; diff --git a/include/core/SkScalar.h b/include/core/SkScalar.h index 9130a7cf12..e1a8a33b27 100644 --- a/include/core/SkScalar.h +++ b/include/core/SkScalar.h @@ -253,5 +253,18 @@ static inline SkScalar SkScalarInterp(SkScalar A, SkScalar B, SkScalar t) { return A + SkScalarMul(B - A, t); } +/** Interpolate along the function described by (keys[length], values[length]) + for the passed searchKey. SearchKeys outside the range keys[0]-keys[Length] + clamp to the min or max value. This function was inspired by a desire + to change the multiplier for thickness in fakeBold; therefore it assumes + the number of pairs (length) will be small, and a linear search is used. + Repeated keys are allowed for discontinuous functions (so long as keys is + monotonically increasing), and if key is the value of a repeated scalar in + keys, the first one will be used. However, that may change if a binary + search is used. +*/ +SkScalar SkScalarInterpFunc(SkScalar searchKey, const SkScalar keys[], + const SkScalar values[], int length); + #endif diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index 1f8ecaaf63..85f542136e 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -103,6 +103,17 @@ static inline void sk_bzero(void* buffer, size_t size) { #define SkAssertResult(cond) cond #endif +namespace { + +template <bool> +struct SkCompileAssert { +}; + +} // namespace + +#define SK_COMPILE_ASSERT(expr, msg) \ + typedef SkCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] + /////////////////////////////////////////////////////////////////////// /** Fast type for signed 8 bits. Use for parameter passing and local variables, not for storage |