gfx/skia/trunk/include/text/SkTextLayout.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/include/text/SkTextLayout.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2011 Google Inc.
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +#ifndef SkTextLayout_DEFINED
    1.12 +#define SkTextLayout_DEFINED
    1.13 +
    1.14 +#include "SkPaint.h"
    1.15 +#include "SkRefCnt.h"
    1.16 +
    1.17 +class SkTextStyle : public SkRefCnt {
    1.18 +public:
    1.19 +    SK_DECLARE_INST_COUNT(SkTextStyle)
    1.20 +
    1.21 +    SkTextStyle();
    1.22 +    SkTextStyle(const SkTextStyle&);
    1.23 +    explicit SkTextStyle(const SkPaint&);
    1.24 +    virtual ~SkTextStyle();
    1.25 +
    1.26 +    const SkPaint& paint() const { return fPaint; }
    1.27 +    SkPaint& paint() { return fPaint; }
    1.28 +
    1.29 +    // todo: bidi-override, language
    1.30 +
    1.31 +private:
    1.32 +    SkPaint fPaint;
    1.33 +
    1.34 +    typedef SkRefCnt INHERITED;
    1.35 +};
    1.36 +
    1.37 +class SkTextLayout {
    1.38 +public:
    1.39 +    SkTextLayout();
    1.40 +    ~SkTextLayout();
    1.41 +
    1.42 +    void setText(const char text[], size_t length);
    1.43 +    void setBounds(const SkRect& bounds);
    1.44 +
    1.45 +    SkTextStyle* getDefaultStyle() const { return fDefaultStyle; }
    1.46 +    SkTextStyle* setDefaultStyle(SkTextStyle*);
    1.47 +
    1.48 +//    SkTextStyle* setStyle(SkTextStyle*, size_t offset, size_t length);
    1.49 +
    1.50 +    void draw(SkCanvas* canvas);
    1.51 +
    1.52 +private:
    1.53 +    SkTDArray<char> fText;
    1.54 +    SkTextStyle*    fDefaultStyle;
    1.55 +    SkRect          fBounds;
    1.56 +
    1.57 +    // cache
    1.58 +    struct Line;
    1.59 +    struct GlyphRun;
    1.60 +    SkTDArray<Line*> fLines;
    1.61 +};
    1.62 +
    1.63 +#endif

mercurial