michael@0: michael@0: /* michael@0: * Copyright 2011 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: #ifndef SkTextLayout_DEFINED michael@0: #define SkTextLayout_DEFINED michael@0: michael@0: #include "SkPaint.h" michael@0: #include "SkRefCnt.h" michael@0: michael@0: class SkTextStyle : public SkRefCnt { michael@0: public: michael@0: SK_DECLARE_INST_COUNT(SkTextStyle) michael@0: michael@0: SkTextStyle(); michael@0: SkTextStyle(const SkTextStyle&); michael@0: explicit SkTextStyle(const SkPaint&); michael@0: virtual ~SkTextStyle(); michael@0: michael@0: const SkPaint& paint() const { return fPaint; } michael@0: SkPaint& paint() { return fPaint; } michael@0: michael@0: // todo: bidi-override, language michael@0: michael@0: private: michael@0: SkPaint fPaint; michael@0: michael@0: typedef SkRefCnt INHERITED; michael@0: }; michael@0: michael@0: class SkTextLayout { michael@0: public: michael@0: SkTextLayout(); michael@0: ~SkTextLayout(); michael@0: michael@0: void setText(const char text[], size_t length); michael@0: void setBounds(const SkRect& bounds); michael@0: michael@0: SkTextStyle* getDefaultStyle() const { return fDefaultStyle; } michael@0: SkTextStyle* setDefaultStyle(SkTextStyle*); michael@0: michael@0: // SkTextStyle* setStyle(SkTextStyle*, size_t offset, size_t length); michael@0: michael@0: void draw(SkCanvas* canvas); michael@0: michael@0: private: michael@0: SkTDArray fText; michael@0: SkTextStyle* fDefaultStyle; michael@0: SkRect fBounds; michael@0: michael@0: // cache michael@0: struct Line; michael@0: struct GlyphRun; michael@0: SkTDArray fLines; michael@0: }; michael@0: michael@0: #endif