michael@0: /* michael@0: * Copyright 2012 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkTextToPathIter_DEFINED michael@0: #define SkTextToPathIter_DEFINED michael@0: michael@0: #include "SkAutoKern.h" michael@0: #include "SkPaint.h" michael@0: michael@0: class SkGlyphCache; michael@0: michael@0: class SkTextToPathIter { michael@0: public: michael@0: SkTextToPathIter(const char text[], size_t length, const SkPaint& paint, michael@0: bool applyStrokeAndPathEffects); michael@0: ~SkTextToPathIter(); michael@0: michael@0: const SkPaint& getPaint() const { return fPaint; } michael@0: SkScalar getPathScale() const { return fScale; } michael@0: michael@0: struct Rec { michael@0: const SkPath* fPath; // may be null for "whitespace" glyphs michael@0: SkScalar fXPos; michael@0: }; michael@0: michael@0: /** michael@0: * Returns false when all of the text has been consumed michael@0: */ michael@0: bool next(const SkPath** path, SkScalar* xpos); michael@0: michael@0: private: michael@0: SkGlyphCache* fCache; michael@0: SkPaint fPaint; michael@0: SkScalar fScale; michael@0: SkFixed fPrevAdvance; michael@0: const char* fText; michael@0: const char* fStop; michael@0: SkMeasureCacheProc fGlyphCacheProc; michael@0: michael@0: SkScalar fXPos; // accumulated xpos, returned in next michael@0: SkAutoKern fAutoKern; michael@0: int fXYIndex; // cache for horizontal -vs- vertical text michael@0: }; michael@0: michael@0: #endif