- java.lang.Object
-
- com.github.weisj.jsvg.nodes.AbstractSVGNode
-
- com.github.weisj.jsvg.nodes.container.BaseContainerNode<TextSegment>
-
- com.github.weisj.jsvg.nodes.text.TextContainer
-
- All Implemented Interfaces:
Container<TextSegment>,HasContext,HasContext.ByDelegate,HasFontContext,HasFontRenderContext,HasPaintContext,HasShape,HasVectorEffects,Renderable,SVGNode,TextSegment,TextSegment.RenderableSegment
- Direct Known Subclasses:
LinearTextContainer,TextPath
abstract class TextContainer extends BaseContainerNode<TextSegment> implements TextSegment.RenderableSegment, HasShape, HasContext.ByDelegate, HasVectorEffects, Renderable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classTextContainer.IntermediateTextMetrics-
Nested classes/interfaces inherited from interface com.github.weisj.jsvg.nodes.prototype.HasContext
HasContext.ByDelegate
-
Nested classes/interfaces inherited from interface com.github.weisj.jsvg.nodes.prototype.HasShape
HasShape.Box
-
Nested classes/interfaces inherited from interface com.github.weisj.jsvg.nodes.text.TextSegment
TextSegment.RenderableSegment
-
Nested classes/interfaces inherited from interface com.github.weisj.jsvg.nodes.text.TextSegment.RenderableSegment
TextSegment.RenderableSegment.UseTextLengthForCalculation
-
-
Field Summary
Fields Modifier and Type Field Description private HasContextcontextprotected AttributeFontSpecfontSpecprivate booleanisVisibleprotected LengthAdjustlengthAdjustprivate java.util.List<@NotNull TextSegment>segmentsprotected LengthtextLengthprivate java.util.Set<VectorEffect>vectorEffects
-
Constructor Summary
Constructors Constructor Description TextContainer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleanacceptChild(@Nullable java.lang.String id, @NotNull SVGNode node)Determine whether the container accepts thisSVGNodeas a child.private voidaccumulateRenderableSegmentMetrics(@NotNull TextSegment.RenderableSegment segment, @NotNull TextContainer.IntermediateTextMetrics metrics, @NotNull RenderContext currentContext)private voidaccumulateSegmentMetrics(@NotNull TextContainer.IntermediateTextMetrics metrics, @NotNull StringTextSegment segment, @NotNull SVGFont font, float letterSpacing, int index)voidaddContent(char[] content)voidappendTextShape(@NotNull GlyphCursor cursor, @NotNull MutableGlyphRun glyphRun, @NotNull RenderContext context)voidbuild(@NotNull AttributeNode attributeNode)java.util.List<? extends @NotNull TextSegment>children()Return all children of this container.protected abstract voidcleanUpLocalCursor(@NotNull GlyphCursor current, @NotNull GlyphCursor local)@NotNull TextMetricscomputeTextMetrics(@NotNull RenderContext context, @NotNull TextSegment.RenderableSegment.UseTextLengthForCalculation flag)@NotNull HasContextcontextDelegate()protected abstract GlyphCursorcreateLocalCursor(@NotNull RenderContext context, @NotNull GlyphCursor current)protected voiddoAdd(@NotNull SVGNode node)(package private) voidforEachSegment(@NotNull RenderContext context, @NotNull java.util.function.BiConsumer<StringTextSegment,RenderContext> onStringTextSegment, @NotNull java.util.function.BiConsumer<TextSegment.RenderableSegment,RenderContext> onRenderableSegment)(package private) abstract @NotNull java.awt.ShapeglyphShape(@NotNull RenderContext context)booleanhasFixedLength()booleanisVisible(@NotNull RenderContext context)private @NotNull GlyphAdvancementlocalGlyphAdvancement(@NotNull RenderContext context, @NotNull GlyphCursor cursor)voidprepareSegmentForRendering(@NotNull GlyphCursor cursor, @NotNull RenderContext context, @NotNull TextOutput textOutput)protected voidrenderSegment(@NotNull GlyphCursor cursor, @NotNull RenderContext context, @NotNull Output output)voidrenderSegmentWithoutLayout(@NotNull GlyphCursor cursor, @NotNull RenderContext context, @NotNull Output output)(package private) @NotNull java.util.List<@NotNull TextSegment>segments()private doubletextAnchorOffset(@NotNull TextAnchor textAnchor, @NotNull GlyphCursor glyphCursor)@NotNull java.awt.geom.Rectangle2DuntransformedElementBounds(@NotNull RenderContext context, HasShape.Box box)@NotNull java.awt.ShapeuntransformedElementShape(@NotNull RenderContext context, HasShape.Box box)@NotNull java.util.Set<VectorEffect>vectorEffects()-
Methods inherited from class com.github.weisj.jsvg.nodes.container.BaseContainerNode
addChild, isAcceptableType
-
Methods inherited from class com.github.weisj.jsvg.nodes.AbstractSVGNode
id, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.weisj.jsvg.nodes.prototype.Container
childrenOfType
-
Methods inherited from interface com.github.weisj.jsvg.nodes.prototype.HasContext.ByDelegate
fontRenderContext, fontSpec, paintContext
-
Methods inherited from interface com.github.weisj.jsvg.nodes.prototype.HasShape
elementBounds, elementShape
-
Methods inherited from interface com.github.weisj.jsvg.nodes.prototype.Renderable
parseIsVisible, render, requiresInstantiation, shouldEstablishChildContext
-
Methods inherited from interface com.github.weisj.jsvg.nodes.text.TextSegment
isValid
-
-
-
-
Field Detail
-
segments
private final java.util.List<@NotNull TextSegment> segments
-
fontSpec
protected AttributeFontSpec fontSpec
-
lengthAdjust
protected LengthAdjust lengthAdjust
-
textLength
protected Length textLength
-
isVisible
private boolean isVisible
-
context
private HasContext context
-
vectorEffects
private java.util.Set<VectorEffect> vectorEffects
-
-
Method Detail
-
build
@MustBeInvokedByOverriders public void build(@NotNull @NotNull AttributeNode attributeNode)- Specified by:
buildin interfaceSVGNode- Overrides:
buildin classAbstractSVGNode
-
vectorEffects
@NotNull public @NotNull java.util.Set<VectorEffect> vectorEffects()
- Specified by:
vectorEffectsin interfaceHasVectorEffects
-
contextDelegate
@NotNull public @NotNull HasContext contextDelegate()
- Specified by:
contextDelegatein interfaceHasContext.ByDelegate
-
segments
@NotNull @NotNull java.util.List<@NotNull TextSegment> segments()
-
acceptChild
protected boolean acceptChild(@Nullable @Nullable java.lang.String id, @NotNull @NotNull SVGNode node)Description copied from class:BaseContainerNodeDetermine whether the container accepts thisSVGNodeas a child. By default, this will always report true but subclasses may choose to reject certain types of nodes.- Overrides:
acceptChildin classBaseContainerNode<TextSegment>- Parameters:
id- the id of the nodenode- the node itself- Returns:
- whether the node can be inserted as a child.
-
doAdd
protected void doAdd(@NotNull @NotNull SVGNode node)- Specified by:
doAddin classBaseContainerNode<TextSegment>
-
addContent
public final void addContent(char[] content)
- Specified by:
addContentin interfaceSVGNode- Overrides:
addContentin classAbstractSVGNode
-
children
public java.util.List<? extends @NotNull TextSegment> children()
Description copied from interface:ContainerReturn all children of this container. Note that the return type of this function internationally contains a wild card to make it a compilation error trying to modify it.- Specified by:
childrenin interfaceContainer<TextSegment>- Returns:
- the list of children.
-
glyphShape
@NotNull abstract @NotNull java.awt.Shape glyphShape(@NotNull @NotNull RenderContext context)
-
untransformedElementShape
@NotNull public final @NotNull java.awt.Shape untransformedElementShape(@NotNull @NotNull RenderContext context, HasShape.Box box)- Specified by:
untransformedElementShapein interfaceHasShape
-
createLocalCursor
protected abstract GlyphCursor createLocalCursor(@NotNull @NotNull RenderContext context, @NotNull @NotNull GlyphCursor current)
-
cleanUpLocalCursor
protected abstract void cleanUpLocalCursor(@NotNull @NotNull GlyphCursor current, @NotNull @NotNull GlyphCursor local)
-
renderSegment
protected final void renderSegment(@NotNull @NotNull GlyphCursor cursor, @NotNull @NotNull RenderContext context, @NotNull @NotNull Output output)
-
textAnchorOffset
private double textAnchorOffset(@NotNull @NotNull TextAnchor textAnchor, @NotNull @NotNull GlyphCursor glyphCursor)
-
forEachSegment
void forEachSegment(@NotNull @NotNull RenderContext context, @NotNull @NotNull java.util.function.BiConsumer<StringTextSegment,RenderContext> onStringTextSegment, @NotNull @NotNull java.util.function.BiConsumer<TextSegment.RenderableSegment,RenderContext> onRenderableSegment)
-
computeTextMetrics
@NotNull public @NotNull TextMetrics computeTextMetrics(@NotNull @NotNull RenderContext context, @NotNull @NotNull TextSegment.RenderableSegment.UseTextLengthForCalculation flag)
- Specified by:
computeTextMetricsin interfaceTextSegment.RenderableSegment
-
accumulateRenderableSegmentMetrics
private void accumulateRenderableSegmentMetrics(@NotNull @NotNull TextSegment.RenderableSegment segment, @NotNull @NotNull TextContainer.IntermediateTextMetrics metrics, @NotNull @NotNull RenderContext currentContext)
-
accumulateSegmentMetrics
private void accumulateSegmentMetrics(@NotNull @NotNull TextContainer.IntermediateTextMetrics metrics, @NotNull @NotNull StringTextSegment segment, @NotNull @NotNull SVGFont font, float letterSpacing, int index)
-
hasFixedLength
public boolean hasFixedLength()
- Specified by:
hasFixedLengthin interfaceTextSegment.RenderableSegment
-
renderSegmentWithoutLayout
public void renderSegmentWithoutLayout(@NotNull @NotNull GlyphCursor cursor, @NotNull @NotNull RenderContext context, @NotNull @NotNull Output output)- Specified by:
renderSegmentWithoutLayoutin interfaceTextSegment.RenderableSegment
-
prepareSegmentForRendering
public void prepareSegmentForRendering(@NotNull @NotNull GlyphCursor cursor, @NotNull @NotNull RenderContext context, @NotNull @NotNull TextOutput textOutput)- Specified by:
prepareSegmentForRenderingin interfaceTextSegment.RenderableSegment
-
appendTextShape
public void appendTextShape(@NotNull @NotNull GlyphCursor cursor, @NotNull @NotNull MutableGlyphRun glyphRun, @NotNull @NotNull RenderContext context)- Specified by:
appendTextShapein interfaceTextSegment.RenderableSegment
-
localGlyphAdvancement
@NotNull private @NotNull GlyphAdvancement localGlyphAdvancement(@NotNull @NotNull RenderContext context, @NotNull @NotNull GlyphCursor cursor)
-
untransformedElementBounds
@NotNull public @NotNull java.awt.geom.Rectangle2D untransformedElementBounds(@NotNull @NotNull RenderContext context, HasShape.Box box)- Specified by:
untransformedElementBoundsin interfaceHasShape
-
isVisible
public boolean isVisible(@NotNull @NotNull RenderContext context)- Specified by:
isVisiblein interfaceRenderable
-
-