Skip to content

TextMarkup

final class TextMarkup
Package: dev.joid.lib.font.markup · Module: core · Source: TextMarkup.java

The registry of the markup tags that every text reads, and the helpers that find the tags in a string.

JOID registers no markup: the tags a text understands are the ones you register, or the ones you give a style with TextInfo.markups.

ReturnsSignatureSummary
voidregister(ITextMarkup markup) staticAdds a markup in front of the others, so that it is tried first; registering it again moves it to the front.
voidunregister(ITextMarkup markup) staticRemoves a markup.
List<ITextMarkup>getRegistered() staticReturns the registered markups, the first tried first, as a list you cannot change.
intparse(List markups, String text, int index, TextStyle style) staticTries each markup of markups at index and returns the length of the first tag found, or 0 when no tag starts there.
int[]tags(String text, TextInfo info) staticReturns, for each character of text, the index where the tag that holds it starts, or -1 for a character outside any tag, with the markups of info.
Stringopened(String text, int[] tags, int end) staticReturns every tag found in text before end, joined, so that a line that starts at end reopens the styles of the previous one.

void register(ITextMarkup markup) static

Adds a markup in front of the others, so that it is tried first; registering it again moves it to the front.

void unregister(ITextMarkup markup) static

Removes a markup.

List<ITextMarkup> getRegistered() static

Returns the registered markups, the first tried first, as a list you cannot change.

int parse(List<ITextMarkup> markups, String text, int index, TextStyle style) static

Tries each markup of markups at index and returns the length of the first tag found, or 0 when no tag starts there.

int[] tags(String text, TextInfo info) static

Returns, for each character of text, the index where the tag that holds it starts, or -1 for a character outside any tag, with the markups of info.

String opened(String text, int[] tags, int end) static

Returns every tag found in text before end, joined, so that a line that starts at end reopens the styles of the previous one.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page