TextShape (クラス)
public TextShape {inherits FontVisualMixin, Shape}
パッケージ: CURL.GUI.SHAPES

1 行のテキストを表現する Shape の実装。

説明

この形状は単純なテキスト ラベル用です。1 行の改行されていないテキストのみレンダリングします。
他の形状と同様に Shape.transformation に従います。 TextShape.advance-angle を使用して字送りの方向を変更することもできます。デモンストレーションについては次の例を参照してください。

注意事項

このクラスは次のオプションを使用します。 このオブジェクトは、"TextShape"のスタイル ルールを記述することによってスタイル化することが出来ます。


{import * from CURL.GUI.SHAPES}

{let shape:TextShape =
    {TextShape
        "A line of text.",
        translation = {Distance2d 3cm, 3cm}
    }
}

{spaced-vbox
    halign = "center",
    {spaced-hbox
        "object rotation on Shape (in deg) (set via transformation): ",
        {TextField
            width = .5in,
            value = "0",
            {on ValueFinished at field:TextField do
                {shape.set-rotation {field.value.to-double} * 1deg}
            }
        }
    },
    {spaced-hbox
        "advance angle (in deg) (set via TextShape.advance-angle): ",
        {TextField
            width = .5in,
            value = {format "%.2f", shape.advance-angle / 1deg},
            {on ValueFinished at field:TextField do
                set shape.advance-angle = {field.value.to-double} * 1deg
            }
        }
    },
    {text
    },
    {HBox
        spacing = .25cm,
        {HBox
            "advance multiplier: ",
            {TextField
                width = .5in,
                value = {format "%.2f", shape.advance-multiplier},
                {on ValueFinished at field:TextField do
                    set shape.advance-multiplier = {field.value.to-double}
                }
            }
        },
        {spaced-hbox
            "halign: ",
            {TextField
                width = .5in,
                value = shape.halign,
                tooltip =
                    {Tooltip
                        {text
                            Valid alignments are
                            {monospace left}, {monospace
                            center}, {monospace origin},
                            {monospace right}, or a number
                            in the range of 0.0 to 1.0.
                        }
                    },
                {on ValueFinished at field:TextField do
                    let p-s:Distance = {shape.get-display-context}.pixel-size
                    let (val:double, chars:int) = {field.value.to-double}
                    {if chars == field.value.size then
                        set shape.halign = val
                     else
                        set shape.halign = field.value
                    }
                }
            }
        },
        {spaced-hbox
            "valign: ",
            {TextField
                width = .5in,
                value = shape.valign,
                tooltip =
                    {Tooltip
                        {text
                            Valid alignments are
                            {monospace top}, {monospace
                            center}, {monospace origin},
                            {monospace bottom}, or a number
                            in the range of 0.0 to 1.0.
                        }
                    },
                {on ValueFinished at field:TextField do
                    let p-s:Distance = {shape.get-display-context}.pixel-size
                    let (val:double, chars:int) = {field.value.to-double}
                    {if chars == field.value.size then
                        set shape.valign = val
                     else
                        set shape.valign = field.value
                    }
                }
            }
        }
    }
}

{center
    {Canvas
        border-width = 1px,
        width = 12cm,
        height = 8cm,
        shape
    }
}

コンストラクタ
clone-appearance-from:新規オブジェクトを生成するためのコンストラクタ。
コンストラクタ protected {TextShape.clone-appearance-from
other:TextShape,
fixup:#{proc-type {Visual, Visual}:Visual}
}
default:新しい TextShape を作成します。
コンストラクタ public {TextShape.default text:String, ...}

プロパティ
advance-angle:字送りに影響を与える回転。
ローカル オプション public TextShape.advance-angle:Angle =0deg
advance-multiplier:文字の間隔を調整する修飾子。
ローカル オプション public TextShape.advance-multiplier:double =1.0
clonable-class?:当該クラスがクローン化可能である場合は、true を返します。その他の場合は false を返します。
アクセサ protected TextShape.clonable-class?:bool
color:ビジュアル オブジェクトには必ず color オプションがあります。このオプションは、継承されたものか、あるいはオブジェクトに直接設定されたものです。GUI Toolkit では、このオプションを使って Rule の色などの一般に周囲のテキストと同じ色に設定されるテキストおよび機能の色を調整します。

ビジュアル オブジェクトによっては、color プロパティを直接使用しないものがあります。たとえば、VBox は色プロパティを使用しません。それでもやはり、内部にあるすべてのアイテムが既定で同じ色を持つように、VBoxの色を設定すると便利です (下の例を参照)。
非ローカル オプション public TextShape.color:FillPattern
display-context:このオブジェクトに関連付けられている DisplayContext
非ローカル オプション public TextShape.display-context:#DisplayContext
halign:このオブジェクトの起点に対する水平方向のテキスト配置です。
ローカル オプション public TextShape.halign:any ="origin"
style-element:スタイリングの目的のための、この Visual の "要素" や "型" です。
アクセサ public TextShape.style-element:String
text:この TextShape に表示される String です。
アクセサ public final TextShape.text:String
セッター public final TextShape.text:String
use-pango?:コンテンツを表示するために Pango を使用するかどうかを示します。
アクセサ public TextShape.use-pango?:bool
セッター public TextShape.use-pango?:bool
valign:このオブジェクトの起点に対する垂直方向のテキスト配置です。
ローカル オプション public TextShape.valign:any ="origin"
プロパティ 継承 FontVisualMixin: cached-display-context, font, font-family, font-size, font-style, font-weight, text-line-through?, text-underline?
プロパティ 継承 Shape: as-Shape, border-color, draw-operation, graphical-parent, option-parent, possibly-displayed?, selection-context, shape-parent, shape-selectable, stroke-thickness, transformation, visible?
プロパティ 継承 ShapeContainerBase: as-ShapeRoot, shape-children
プロパティ 継承 DataBindingTarget: data-binding-context, data-bindings
プロパティ 継承 Visual: _style-element, completely-clonable-children?, cursor, data-source, dragee, has-key-focus?, input-method-enabled?, input-method-keyboard-mode, name, options, style-class, style-manager, style-options, test-child?, test-description, test-name, test-parent?, test-type-name, test-visible?, tooltip, user-data, visual-parent
プロパティ 継承 OptionListInterface: option-register-proc, options-present-here, registered-option-keys
プロパティ 継承 EventTarget: event-handlers

メソッド
clone-appearance-helper:クローンを作成し、クローン自体を返します。
protected {TextShape.clone-appearance-helper
fixup:#{proc-type {Visual, Visual}:Visual}
}:Visual
draw:このオブジェクトの可視表現を描画します。
public {TextShape.draw renderer2d:Renderer2d}:void
get-display-context:このオブジェクトの現在の DisplayContext を返します。
public {TextShape.get-display-context}:DisplayContext
get-own-bounds:ローカル座標系におけるこの Shape の四角形のレンダリング境界を計算します。
public {TextShape.get-own-bounds dest:GRect = {GRect.empty}}:GRect
get-own-bounds-in-shape-root:形状ルートである祖先の座標系における、この形状の四角形のレンダリング境界を計算します。
public {TextShape.get-own-bounds-in-shape-root
dest:GRect = {GRect.empty}
}:GRect
overdraw-for-selection:このオブジェクトの上に選択アフォーダンスを描画します。
public {TextShape.overdraw-for-selection}:void
react-to-font-option-change:フォントに関するオプションの変更に対応します。
protected {TextShape.react-to-font-option-change
metrics-changed?:bool
}:void
request-draw-self:再描画する Shape に属するピクセルを要求します。
public {TextShape.request-draw-self
layout-context:LayoutContext = {self.get-layout-context}
}:void
self-contains-point?:ポイントがこの Shape 内にあるかどうかを判定します。
public {TextShape.self-contains-point? x:Distance, y:Distance}:bool
self-intersects-polygon?:ポリゴンがこの Shape と交差するかどうかを判定します。
public {TextShape.self-intersects-polygon?}:bool
transformation-changed:Shape.transformation が変更されたことの通知。
public {TextShape.transformation-changed}:void
メソッド 継承 FontVisualMixin: calculate-pointsize, font-option-changed, invalidate-font, update-font-metrics, validate-font
メソッド 継承 Shape: apply-rotation, apply-scale, apply-transformation, apply-translation, apply-translation-in-parent, constrain-own-layout-bounds, constrain-shape-layout-bounds, contains-point?, detach, find-graphical-ancestor, fire-crossing-event, fire-in-child, get-down-orientation-in-shape-parent, get-graphical-root, get-gui-path, get-gui-path-to-child, get-local-device-pixel-size, get-origin-in-graphical-ancestor, get-origin-in-root, get-origin-in-shape-parent, get-origin-in-shape-root, get-own-layout-bounds, get-right-orientation-in-shape-parent, get-shape-bounds, get-shape-bounds-in-shape-root, get-shape-layout-bounds, get-top-left-in-ancestor, get-transformation-to-shape-root, keyword-init-arg, option-change-notify, quantize-line-thickness, request-draw, reset-transformation, set-rotation, set-scale, set-transformation, set-translation-in-parent, to-Graphic, transform-from-display-coordinates, transform-from-graphical-root-coordinates, transform-point-from-shape-root, transform-point-to-shape-root, transform-to-display-coordinates, transform-to-graphical-root-coordinates, transform-vector-from-shape-root, transform-vector-to-shape-root, transformation-changing
メソッド 継承 GraphicOptions: any-to-Distance
メソッド 継承 ShapeContainerBase: add, clear, clone-children, draw-shape-child, draw-shape-children, get-all-children-at-point, get-child-at-point, get-leaf-at-point, get-shape-root, note-attached, note-detaching, notify-option-children, on-drag-enter, on-pointer-enter, on-pointer-envelope-event, register-options, remove, set-shape-index, set-shape-index-after, set-shape-index-before, shape-container-fire-inferior-crossing-event, shape-container-handle-crossing, shape-container-pick-child, shape-container-pointer-enter-occurred, shape-container-pointer-leave-occurred
メソッド 継承 DataBindingTarget: add-data-binding, get-data-binding, refresh-data-binding, remove-data-binding, unset-property, update-data-binding, validate-data-binding
メソッド 継承 Visual: add-from-init-args, animate, change-cursor, clonable-appearance?, clone-appearance, find-test-children, get-focus-manager, get-layout-context, get-test-parent, get-test-property, get-text, get-view, maybe-fire-attach-event, maybe-fire-detach-event, non-keyword-init-arg, note-caret-position, on-drag-leave, on-pointer-leave, pop-cursor, prepare-test-object, prepare-test-parent, push-cursor, quantize-width, refresh-style-options, release-key-focus, request-key-focus, scroll-to-include, test-record, test-run, xy-offset-to
メソッド 継承 OptionListInterface: add-option, add-style-option, change-option-parent-notify, clone-options, get-option, get-option-by-name, local-add-notify, local-remove-notify, name-to-option-key, new-option-item, option-changed, option-lookup, option-lookup-here, option-propagate-notify, option-set?, propagate-option-change, remove-option, remove-style-option, remove-styles, set-option-by-name, set-style-option-by-name, unset-option-by-name, unset-style-option-by-name
メソッド 継承 GuiEventTarget: handle-delegate-event, handle-event, on-action, on-cancel-mode, on-command-changed, on-commit, on-composition-change-event, on-composition-result-event, on-context-menu-event, on-current-record-change-request, on-current-record-changed, on-destroy-notify, on-destroy-requested, on-drag-over, on-drag-pointer, on-drag-started, on-drop, on-end-composition-event, on-focus-event, on-focus-in, on-focus-out, on-gesture, on-gesture-begin, on-gesture-end, on-gesture-magnify, on-gesture-pan, on-gesture-rotate, on-gesture-swipe, on-gesture-tap, on-gesture-touch, on-grab-release, on-gui-event, on-input-method-event, on-inspection, on-key-event, on-key-press, on-pointer-button, on-pointer-crossing, on-pointer-event, on-pointer-motion, on-pointer-press, on-pointer-release, on-pointer-scroll, on-raw-key-event, on-raw-key-press, on-raw-key-release, on-reset, on-selectable-added, on-selectable-removed, on-selection-changed, on-selection-context-activated, on-selection-context-deactivated, on-selection-event, on-start-composition-event, on-start-event, on-stop-event, on-view-activate, on-view-deactivate, on-window-close, remove-event-handlers-for-event-class
メソッド 継承 InitRestArgParser: process-rest-args
メソッド 継承 EventTarget: accepts-event-class?, add-event-handler, event-handler-present?, remove-event-handler, verify-event
メソッド 継承 BasicEventTarget: enqueue-event
メソッド 継承 Object: object-describe, object-describe-for-debugging, object-serialize



コンストラクタ詳細
clone-appearance-from (コンストラクタ)
protected {TextShape.clone-appearance-from
other:TextShape,
fixup:#{proc-type {Visual, Visual}:Visual}
}

新規オブジェクトを生成するためのコンストラクタ。

other: クローンする TextShape
fixup:
各クローンを作成するために呼び出されるプロシージャ。クローン化する時に使用され TextShape.clone-children に渡されます。
このプロシージャは二つの引数と共に呼び出されます。元のオブジェクトと clone-appearance のメカニズムによって生成されたコピーオブジェクトです。このプロシージャによって返された値はクローンとして使用されます。このプロシージャはコピーするオブジェクトに修正を加えて返すことができます。このプロシージャが null を返すことはできません。

説明

クローン化をサポートする TextShape のサブクラスはこのコンストラクタを呼び出すコンストラクタを持たなければなりません。クローンされた子に追加しなければならない情報があるかどうか分からない場合、このコンストラクタはサブクラスの子のクローンを作成しません。このクラスのサブクラスは子のクローンを作成しそれらを追加する必要があります。追加の情報が必要でない場合、単に TextShape.clone-children を呼び出すだけです。そうでない場合は、TextShape.clone-children をオーバーライドしそれを呼び出さなければなりません。通常、clone-apperance-from コンストラクタから呼び出される TextShape.clone-children は以下のようになります。
{if {type-of self} == {compile-time-type-of self} then
    {self.clone-children other, fixup}
}


default (コンストラクタ)
public {TextShape.default text:String, ...}

新しい TextShape を作成します。

text: 表示される最初の文字列です。
...: 通常の Shape の作成引数を渡せます。たとえば、イニシャライザ、変換、子 Shape などです。詳細については、Shape.default を参照してください。

注意事項

キーワード引数を使用して TextShape.advance-multiplier および TextShape.advance-angle プロパティを初期化することもできます。



プロパティ詳細
advance-angle (ローカル オプション)
public TextShape.advance-angle:Angle =0deg

字送りに影響を与える回転。

説明

これは、個々の文字の回転ではなく文字列の方向を効果的に変更します。既定値の 0 度を指定すると、通常の変更前の文字列になります。90 度を指定すると、垂直方向の文字列になります。


advance-multiplier (ローカル オプション)
public TextShape.advance-multiplier:double =1.0

文字の間隔を調整する修飾子。

説明

この値は、文字間の通常の送り幅を乗算します。したがって、値が 1.0 (既定) の場合は文字列は通常の間隔でレンダリングされます。2.0 の場合、文字の間隔は通常の 2 倍になります。また、0 の場合は、すべての文字が同じ位置に描画されます。
モノスペース フォントを使用する場合を除いて、拡大率または縮小率は文字によって異なります。これは、文字はそれぞれ幅が異なるからです。字送りは各文字の幅によって決まり、advance-multiplier はこの送り幅を変更します。


clonable-class? (アクセサ)
アクセサ protected TextShape.clonable-class?:bool

当該クラスがクローン化可能である場合は、true を返します。その他の場合は false を返します。

オーバーライド

既定の実装は false を返します。クローン化機能を提供するクラスは、{type-of self} == {compile-time-type-of self} を返すためには、このゲッターをオーバーライドする必要があります。クローン化可能な Visual が必ずしもクローン化可能であるとは限らないので、単に true を返すだけでは正しくありません。
このメソッドをオーバーライドする場合は、Visual.clone-appearance-helper もオーバーライドする必要があります。


color (非ローカル オプション)
public TextShape.color:FillPattern

ビジュアル オブジェクトには必ず color オプションがあります。このオプションは、継承されたものか、あるいはオブジェクトに直接設定されたものです。GUI Toolkit では、このオプションを使って Rule の色などの一般に周囲のテキストと同じ色に設定されるテキストおよび機能の色を調整します。

ビジュアル オブジェクトによっては、color プロパティを直接使用しないものがあります。たとえば、VBox は色プロパティを使用しません。それでもやはり、内部にあるすべてのアイテムが既定で同じ色を持つように、VBoxの色を設定すると便利です (下の例を参照)。

説明

各種オブジェクトではこのオプションを次のように使用しています。
color は非ローカルオプションなので、これを適用するオブジェクトを含む任意のグラフィカル オブジェクトに設定できます。
このオプションは、任意の FillPattern に設定できます。FillPattern の指定方法の詳細については、「塗りつぶしパターンとテクスチャ」の章を参照してください。

テキスト、ルール、形状を含むオブジェクトにを設定した結果を次に示します。


{VBox
    background="silver",
    color="green",
    {text The default color in this VBox is {bold green}.},
    {Rule height=1pt},
    {text The thick Rule below is {bold yellow}.},
    {Rule color="yellow", height=3pt},
    {text color = "blue", Next are two ellipse's, with and 
        without a color setting
    },
    {HBox spacing=6pt,
        {EllipticalArcGraphic
            width=1in, height=0.5in,
            color = "aqua"
        },
        {EllipticalArcGraphic
            width=1in, height=0.5in
        }
    }
}


display-context (非ローカル オプション)
public TextShape.display-context:#DisplayContext

このオブジェクトに関連付けられている DisplayContext

プログラミング注意事項

このオプションは、Curl グラフィック システム内での通信のために使用されます。これは、ユーザー コードで不用意に設定や設定解除を行わないでください。また、通常は、ユーザー コードで直接読み取るべきではありません。現在の DisplayContext が必要な場合は、Visual.get-display-context を呼び出すことによりフェッチしてください。

画面上のウィンドウまたは印刷されたページで表示可能なすべてのグラフィック階層は、そのルートにおいて、display-context オプションを DisplayContext オブジェクトに設定するオブジェクトを持つ必要があります。このオブジェクトは、グラフィック階層の表示に使用される表示媒体に適しています。つまり、オブジェクトは、display-context オプションの値が null から非 null DisplayContext オブジェクトに変更されるのをモニタリングすることにより、表示不可能なグラフィック階層に連結されていることを認識します。したがって、特定の動作を実行する必要のある Visual のサブクラスは、表示不可能なグラフィック階層に接続された場合、次のようなオプション宣言を含むことにより display-context オプションをモニタリングします。

{nonlocal-option public display-context:#DisplayContext
change handler}


ここで、change handler 内のコードは display-context オプションの現在値 (変数 display-context の値として、変更ハンドラ内にある) を取得し、null および非 null の値の間で行われる変更をモニタリングし、必要とされる動作を実行します。

ただし、このプログラミング熟語を使用するプログラマーは、グラフィカル表示を再配列する際、グラフィック階層からグラフィカル オブジェクトを一時的に分離し、これらを同じ階層に再アタッチすることが、割に一般的であることを理解するべきです。この処理により、一時的に分離されたオブジェクトは、display-context オブジェクトが null になり、再び非 null になるのを観察します。display-context オプションでの変更をモニタリングするコードは、この可能性を考慮に入れ、この状況における望ましくない動作の実行を回避しなくてはなりません。


halign (ローカル オプション)
public TextShape.halign:any ="origin"

このオブジェクトの起点に対する水平方向のテキスト配置です。

説明

この値は、文字列または浮動小数点値です。有効な文字列は、「left」、「origin」、「center」、および「right」です。既定値は「origin」であり、「center」と同義です。値が浮動小数点値の場合は、文字列の位置を 0 ~ 1 の範囲で指定します。0 は「left」、1 は「right」と同じ意味です。

注意事項

このパラメータの使用例については、TextShape のクラスの説明を参照してください。


style-element (アクセサ)
アクセサ public TextShape.style-element:String

スタイリングの目的のための、この Visual の "要素" や "型" です。

説明

この実装によって Visual._style-elementの値が返されますが、通常は定数を返すためにオーバーライドされます。

オーバーライド

Visual のサブクラスのスタイルが他のオブジェクトと異なる場合、このゲッターは適切な文字列を返すようにオーバーライドされる必要があります。 慣例では,この文字列はクラス名または、オブジェクトを生成するマークアップの名前です。
オーバーライドでは、空の文字列でないかぎり、self._style-elementを返さなければなりません。
導入: バージョン 6.0


text (アクセサ)
アクセサ public final TextShape.text:String
セッター public final TextShape.text:String

この TextShape に表示される String です。



use-pango? (アクセサ)
アクセサ public TextShape.use-pango?:bool
セッター public TextShape.use-pango?:bool

コンテンツを表示するために Pango を使用するかどうかを示します。

導入: バージョン 7.0

改訂

バージョン 7.0 では、この値は常に false です。将来のサービスパックでサポートされる可能性があります。


valign (ローカル オプション)
public TextShape.valign:any ="origin"

このオブジェクトの起点に対する垂直方向のテキスト配置です。

説明

この値は、文字列または浮動小数点値です。有効な文字列は、「top」、「origin」、「center」、および「bottom」です。既定値は「origin」で、オブジェクトの起点をテキストのベースラインに揃えます。
値が浮動小数点値の場合は、文字列の位置を 0 ~ 1 の範囲で指定します。0 は「top」、1 は「bottom」と同じ意味です。

注意事項

このパラメータの使用例については、TextShape のクラスの説明を参照してください。





メソッド詳細
clone-appearance-helper (メソッド)
protected {TextShape.clone-appearance-helper
fixup:#{proc-type {Visual, Visual}:Visual}
}:Visual

クローンを作成し、クローン自体を返します。

オーバーライド

既定の実装はエラーをスローします。クローン化機能を提供するクラスは、
{{compile-time-type-of self}.clone-appearance-from self, fixup}
を返すためには、このゲッターをオーバーライドする必要があります。


draw (メソッド)
public {TextShape.draw renderer2d:Renderer2d}:void

このオブジェクトの可視表現を描画します。

renderer2d: このオブジェクトを使用してそれ自身を描画する Renderer2d

オーバーライド

Shape をサブクラス化する場合は、このメソッドをオーバーライドする必要があります。


get-display-context (メソッド)
public {TextShape.get-display-context}:DisplayContext

このオブジェクトの現在の DisplayContext を返します。

戻り値

GraphicOptions.display-context オプションが非 null 値にバインドされる場合、このオプションの値を返します。それ以外の場合、get-default-display-context によって返される値を返します。

オーバーライド

通常はオーバーライドされません。


get-own-bounds (メソッド)
public {TextShape.get-own-bounds dest:GRect = {GRect.empty}}:GRect

ローカル座標系におけるこの Shape の四角形のレンダリング境界を計算します。

dest: データを返すために使用されるオプションの GRect オブジェクト。

戻り値

境界を含む GRect オブジェクト。これは、常に dest と同じオブジェクトになります。この GRect は正しい形式である必要があります。つまり、次の条件が true でなければなりません。 -dest.lextent <= dest.rextent and -dest.ascent <= dest.descent

説明

返された境界は、このオブジェクトによって描画されるすべてのピクセルをカバーしている必要があります。ただし、このオブジェクトのすべての子を含んでいません

注意事項

レンダリング境界 (get-own-bounds) とレイアウト境界 (get-own-layout-bounds) は、通常似ていますが、同じではありません。特に、レンダリング境界は非常に包括的ですが、レイアウト境界はそれぞれが整然と隣接するため、Shape を厳密に記述しなければならなりません。

オーバーライド

Shape をサブクラス化する場合は、このメソッドをオーバーライドする必要があります。データを返すには、dest パラメータを使用する必要があります。


get-own-bounds-in-shape-root (メソッド)
public {TextShape.get-own-bounds-in-shape-root
dest:GRect = {GRect.empty}
}:GRect

形状ルートである祖先の座標系における、この形状の四角形のレンダリング境界を計算します。

dest: データを返すために使用されるオプションの GRect オブジェクト。

戻り値

境界を含む GRect オブジェクト。これは、常に dest と同じオブジェクトになります。この GRect は正しい形式である必要があります。つまり、次の条件が true でなければなりません。 -dest.lextent <= dest.rextent and -dest.ascent <= dest.descent

説明

返された境界は、このオブジェクトによって描画されるすべてのピクセルをカバーしている必要があります。ただし、このオブジェクトのすべての子を含んでいません
このメソッドは、Shape.get-own-bounds を呼び出して境界を正しい座標系に変換するために実装されます。

注意事項

形状ルートを持たない形状に対してこのメソッドを呼び出すことはできません。例外が発生します。

オーバーライド

軸平行の四角形を使用するよりも厳密な方法でオブジェクトの境界を変換できる場合は、このメソッドを独自の Shape 実装でオーバーライドすることをお勧めします。


overdraw-for-selection (メソッド)
public {TextShape.overdraw-for-selection}:void

このオブジェクトの上に選択アフォーダンスを描画します。

説明

このメソッドは、内部の形状描画メカニズムにより呼び出されます。通常は、直接呼び出す必要はありません。

オーバーライド

このメソッドの既定の実装では、オブジェクトの境界を Shape.get-own-bounds によって返されるものとみなしています。draw-styleinvert の場合は、DrawOperation.invert-destination を使用して四角形をレンダリングします。mask の場合は、Renderer2d.render-stippled-rectangle が使用されます。
Shape の実装でこのメソッドをオーバーライドする必要はありませんが、形状のレンダリングされたプリミティブの真上に選択アフォーダンスを描画したほうが選択が見やすくなる場合があります。


react-to-font-option-change (メソッド)
protected {TextShape.react-to-font-option-change
metrics-changed?:bool
}:void

フォントに関するオプションの変更に対応します。

metrics-changed?: true の場合は、フォントを記述するメトリックが変わっている可能性があります。これは、フォントが変わっていなくても true であることがありません。例えば、display-context が変わるとフォントのメトリックの解釈が変わるので、metrics-changed? が true になります。

オーバーライド

再描画やレイアウト操作が適切に行われるように、サブクラスがこのメソッドをオーバーライドすることがあります。super.react-to-font-option-change の呼び出しは不要です。


request-draw-self (メソッド)
public {TextShape.request-draw-self
layout-context:LayoutContext = {self.get-layout-context}
}:void

再描画する Shape に属するピクセルを要求します。

説明

このメソッドは、すべての子を再描画する必要がないという点を除けば、Shape.request-draw と同じです。


self-contains-point? (メソッド)
public {TextShape.self-contains-point? x:Distance, y:Distance}:bool

ポイントがこの Shape 内にあるかどうかを判定します。

x: 点の X 座標。
y: 点の Y 座標。

戻り値

この Shape が (xy) を含む場合は、true

説明

ポイントは、このオブジェクトのローカル座標系にあります。このメソッドは、その子を考慮しません。

オーバーライド

Shape をサブクラス化する場合は、このメソッドをオーバーライドする必要があります。このメソッドは、PointerMotion などのマウス イベントをこのオブジェクトにいつ送信するかなどを決定します。
通常は、このメソッドを実装して、ポイントが形状の境界内にあるかどうかだけでなく、ポイントが形状のレンダリングされたプリミティブ内にあるどうかを確認する必要があります。このメソッドは必要なメトリックを使用して自在に実装できます。


self-intersects-polygon? (メソッド)
public {TextShape.self-intersects-polygon?}:bool

ポリゴンがこの Shape と交差するかどうかを判定します。

polygon: この形状のローカル座標空間にポリゴンを記述するポイント セットを含むオブジェクト。このポリゴンは必ず凸型であり、反時計回りのワインディング順に従います。

説明

このメソッドは、ポイントではなく領域を処理する点を除けば、Shape.self-contains-point? とよく似ています。主に領域ベースの選択をサポートするために使用されますが、直接呼び出すこともできます。

オーバーライド

Shape をサブクラス化する場合は、このメソッドをオーバーライドする必要があります。子を考慮する必要はありません。
通常は、このメソッドを実装して、領域が形状の境界内にあるかどうかだけでなく、領域が形状のレンダリングされたプリミティブと交差するかどうかを確認する必要があります。このメソッドは、必要なメトリックを使用して自在に実装できます。このメソッドの実装が Shape.self-contains-point? と調和しない場合は、このオブジェクトを選択すると予期しない結果になります。
選択機能を使用しない場合は、このメソッドを単純に false を返すように実装できます。


transformation-changed (メソッド)
public {TextShape.transformation-changed}:void

Shape.transformation が変更されたことの通知。

オーバーライド

重要:このメソッドのオーバーライド実装にスーパークラス実装の呼び出しを含めて、オブジェクトの新しい領域を無効にする必要があります。