Top Description Inners Fields Constructors Methods
org.jabref.htmltonode.internal

public final Class RenderSupport

extends Object
Class Inheritance
Imports
java.util.ArrayList, .List, .Locale, .Optional, javafx.scene.image.Image, .ImageView, javafx.scene.paint.Color, org.jabref.htmltonode.HtmlRenderOptions, org.jabref.htmltonode.model.CssLength, .Inline, .InlineStyle, org.jspecify.annotations.Nullable

Rendering helpers shared by the TextFlow-based and the RichTextArea-based renderer.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static record
RenderSupport.TextPiece

A run fragment with a relative size factor (used for small-caps emulation).

Field Summary

Modifier and TypeField and Description
private static final double[]
HEADING_SCALE

Font scale per heading level (<h1>–<h6>), mirroring common browser defaults.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static boolean
public static @Nullable ImageView
createImageView(Inline.Image image, HtmlRenderOptions options, double baseSize)

Creates a sized ImageView for an <img>, or null when images are disabled or the source scheme is not allowed (http(s): requires HtmlRenderOptions#loadRemoteImages()).

public static double
headingScale(int level)

public static Optional<Color>
private static RenderSupport.TextPiece
piece(StringBuilder text, boolean lower)

public static List<RenderSupport.TextPiece>
splitForSmallCaps(String text, InlineStyle style)

Small-caps emulation: lowercase stretches are rendered as smaller capitals.

public static String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

HEADING_SCALEback to summary
private static final double[] HEADING_SCALE

Font scale per heading level (<h1>–<h6>), mirroring common browser defaults.

Constructor Detail

RenderSupportback to summary
private RenderSupport()

Method Detail

allowedImageSourceback to summary
private static boolean allowedImageSource(String source, HtmlRenderOptions options)
createImageViewback to summary
public static @Nullable ImageView createImageView(Inline.Image image, HtmlRenderOptions options, double baseSize)

Creates a sized ImageView for an <img>, or null when images are disabled or the source scheme is not allowed (http(s): requires HtmlRenderOptions#loadRemoteImages()).

headingScaleback to summary
public static double headingScale(int level)
parseColorback to summary
public static Optional<Color> parseColor(String value)
pieceback to summary
private static RenderSupport.TextPiece piece(StringBuilder text, boolean lower)
splitForSmallCapsback to summary
public static List<RenderSupport.TextPiece> splitForSmallCaps(String text, InlineStyle style)

Small-caps emulation: lowercase stretches are rendered as smaller capitals.

toCssColorback to summary
public static String toCssColor(Color color)
org.jabref.htmltonode.internal back to summary

public final Record RenderSupport.TextPiece

extends Record
Class Inheritance
Record Components
text:String 
sizeFactor:double 

A run fragment with a relative size factor (used for small-caps emulation).

Field Summary

Modifier and TypeField and Description
private final double
sizeFactor

Record Component accessed by sizeFactor().

private final String
text

Record Component accessed by text().

Constructor Summary

AccessConstructor and Description
public
TextPiece(String text, double sizeFactor)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public double
sizeFactor()

Record Component getter of sizeFactor.

public String
text()

Record Component getter of text.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

sizeFactorback to summary
private final double sizeFactor

Record Component accessed by sizeFactor().

textback to summary
private final String text

Record Component accessed by text().

Constructor Detail

TextPieceback to summary
public TextPiece(String text, double sizeFactor)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

sizeFactorback to summary
public double sizeFactor()

Record Component getter of sizeFactor.

textback to summary
public String text()

Record Component getter of text.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.