JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.graph.font.Font Interface Reference

Interface wrapper for font implementation. More...

Collaboration diagram for com.jogamp.graph.font.Font:

Classes

interface  CodepointIDVisitor
 General purpose (unicode) codepoint symbol and Font.Glyph ID visitor without enforcing Glyph caching. More...
 
interface  Glyph
 Glyph for font. More...
 
interface  GlyphVisitor
 General purpose Font.Glyph visitor. More...
 
interface  GlyphVisitor2
 General purpose Font.Glyph visitor w/o AffineTransform. More...
 
interface  Metrics
 Metrics for font. More...
 

Public Member Functions

String getName (final int nameIndex)
 
String getFullFamilyName ()
 Shall return the family and subfamily name, separated a dash. More...
 
StringBuilder getAllNames (final StringBuilder string, final String separator)
 
int hashCode ()
 Returns the hash code based on NAME_UNIQUNAME. More...
 
boolean equals (final Object o)
 Returns true if other instance is of same type and NAME_UNIQUNAME is equal. More...
 
int getAdvanceWidthFU (final int glyphID)
 Returns advance-width of given glyphID in font-units, sourced from hmtx table - same as Glyph#getAdvanceWidthFU(). More...
 
float getAdvanceWidth (final int glyphID)
 Returns advance-width of given glyphID in font em-size [0..1], sourced from hmtx table - same as Glyph#getAdvanceWidth(). More...
 
Metrics getMetrics ()
 
int getGlyphCount ()
 Returns number of Glyph IDs available, i.e. More...
 
int getDefinedCount (final CharSequence text)
 Returns the number of defined Glyphs (coverage), i.e. More...
 
char getGlyphCodepoint (final String name)
 Returns the Glyph (unicode) codepoint symbol mapped to given Glyph name. More...
 
String getUTF16String (final String name)
 Returns UTF-16 representation of the specified Glyph name using getGlyphCodepoint(String) and getUTF16String(char). More...
 
int getGlyphID (final char codepoint)
 Returns the Glyph ID mapped to given UTF16 (unicode) codepoint symbol. More...
 
Glyph getGlyph (final String name)
 Returns the Glyph mapped to given name. More...
 
Glyph getGlyph (final char codepoint)
 Returns the Glyph mapped to given (unicode) codepoint symbol. More...
 
Glyph getGlyph (final int glyph_id)
 Returns the Glyph using given ID. More...
 
void forAllCodepoints (final Font.CodepointIDVisitor visitor)
 Visit all (unicode) codepoint symbol and Glyph ID tuple of this font. More...
 
void forAllGlyphs (final Font.GlyphVisitor2 visitor)
 Visit all Glyphs of this font. More...
 
int getLineHeightFU ()
 Returns line height, baseline-to-baseline in font-units, composed from ‘hhea’ table entries. More...
 
float getLineHeight ()
 Returns line height, baseline-to-baseline in em-size [0..1], composed from ‘hhea’ table entries. More...
 
AABBox getMetricBoundsFU (final CharSequence string)
 Returns metric-bounds in font-units. More...
 
AABBox getMetricBounds (final CharSequence string)
 Returns metric-bounds in font em-size. More...
 
AABBox getGlyphBounds (final CharSequence string)
 Try using getGlyphBounds(CharSequence, AffineTransform, AffineTransform) to reuse AffineTransform instances. More...
 
AABBox getGlyphBounds (final CharSequence string, final AffineTransform tmp1, final AffineTransform tmp2)
 Returns accurate bounding box by taking each glyph's font em-sized bounding box into account. More...
 
AABBox getGlyphBoundsFU (final CharSequence string)
 Try using getGlyphBoundsFU(CharSequence, AffineTransform, AffineTransform) to reuse AffineTransform instances. More...
 
AABBox getGlyphBoundsFU (final CharSequence string, final AffineTransform tmp1, final AffineTransform tmp2)
 Returns accurate bounding box by taking each glyph's font-units sized bounding box into account. More...
 
AABBox getGlyphShapeBounds (final AffineTransform transform, final CharSequence string)
 Returns accurate bounding box by taking each glyph's font em-sized OutlineShape into account. More...
 
AABBox getGlyphShapeBounds (final AffineTransform transform, final CharSequence string, final AffineTransform tmp1, final AffineTransform tmp2)
 Returns accurate bounding box by taking each glyph's font em-sized OutlineShape into account. More...
 
boolean isPrintableChar (final char c)
 
AABBox processString (final Font.GlyphVisitor visitor, final AffineTransform transform, final CharSequence string)
 Try using processString(GlyphVisitor, AffineTransform, CharSequence, AffineTransform, AffineTransform) to reuse AffineTransform instances. More...
 
AABBox processString (final Font.GlyphVisitor visitor, final AffineTransform transform, final CharSequence string, final AffineTransform temp1, final AffineTransform temp2)
 Visit each Glyph and perhaps its OutlineShape of the string with the Font.GlyphVisitor while passing the progressed AffineTransform. More...
 
void processString (final Font.GlyphVisitor2 visitor, final CharSequence string)
 Visit each Glyph and perhaps its OutlineShape of the string with the constrained Font.GlyphVisitor2. More...
 
String toString ()
 Returns getFullFamilyName(). More...
 
String fullString ()
 Returns all font details as string. More...
 

Static Public Member Functions

static String getUTF16String (final char codepoint)
 Returns UTF-16 representation of the specified (unicode) codepoint symbol like Character#toChars(int) or Character#toString(). More...
 
static Font getBestCoverage (final Font a, final Font b, final CharSequence s)
 Returns Font with best coverage for given text while favoring a. More...
 

Static Public Attributes

static final int NAME_COPYRIGHT = 0
 font name indices for name table More...
 
static final int NAME_FAMILY = 1
 
static final int NAME_SUBFAMILY = 2
 
static final int NAME_UNIQUNAME = 3
 
static final int NAME_FULLNAME = 4
 
static final int NAME_VERSION = 5
 
static final int NAME_MANUFACTURER = 8
 
static final int NAME_DESIGNER = 9
 

Detailed Description

Member Function Documentation

◆ equals()

boolean com.jogamp.graph.font.Font.equals ( final Object  o)

Returns true if other instance is of same type and NAME_UNIQUNAME is equal.

Here is the caller graph for this function:

◆ forAllCodepoints()

void com.jogamp.graph.font.Font.forAllCodepoints ( final Font.CodepointIDVisitor  visitor)

Visit all (unicode) codepoint symbol and Glyph ID tuple of this font.

Parameters
visitorhandling each (unicode) codepoint symbol and Glyph ID tuple.

◆ forAllGlyphs()

void com.jogamp.graph.font.Font.forAllGlyphs ( final Font.GlyphVisitor2  visitor)

Visit all Glyphs of this font.

Warning: All Glyphs will be cached.

Parameters
visitorhandling each Glyph

◆ fullString()

String com.jogamp.graph.font.Font.fullString ( )

Returns all font details as string.

Here is the caller graph for this function:

◆ getAdvanceWidth()

float com.jogamp.graph.font.Font.getAdvanceWidth ( final int  glyphID)

Returns advance-width of given glyphID in font em-size [0..1], sourced from hmtx table - same as Glyph#getAdvanceWidth().

Parameters
glyphID
Here is the caller graph for this function:

◆ getAdvanceWidthFU()

int com.jogamp.graph.font.Font.getAdvanceWidthFU ( final int  glyphID)

Returns advance-width of given glyphID in font-units, sourced from hmtx table - same as Glyph#getAdvanceWidthFU().

Parameters
glyphID

◆ getAllNames()

StringBuilder com.jogamp.graph.font.Font.getAllNames ( final StringBuilder  string,
final String  separator 
)

◆ getBestCoverage()

static Font com.jogamp.graph.font.Font.getBestCoverage ( final Font  a,
final Font  b,
final CharSequence  s 
)
static

Returns Font with best coverage for given text while favoring a.

See getDefinedCount(CharSequence).

return a.getDefinedCount(text) >= b.getDefinedCount(text) ? a : b;

Definition at line 349 of file Font.java.

Here is the call graph for this function:

◆ getDefinedCount()

int com.jogamp.graph.font.Font.getDefinedCount ( final CharSequence  text)

Returns the number of defined Glyphs (coverage), i.e.

not Glyph#isUndefined(), of given text.

Here is the caller graph for this function:

◆ getFullFamilyName()

String com.jogamp.graph.font.Font.getFullFamilyName ( )

Shall return the family and subfamily name, separated a dash.

getName(StringBuilder, int) w/ NAME_FAMILY and NAME_SUBFAMILY

Example: "@iliteral{code} Ubuntu-Regular @endiliteral "


Here is the caller graph for this function:

◆ getGlyph() [1/3]

Glyph com.jogamp.graph.font.Font.getGlyph ( final char  codepoint)

Returns the Glyph mapped to given (unicode) codepoint symbol.

◆ getGlyph() [2/3]

Glyph com.jogamp.graph.font.Font.getGlyph ( final int  glyph_id)

Returns the Glyph using given ID.

◆ getGlyph() [3/3]

Glyph com.jogamp.graph.font.Font.getGlyph ( final String  name)

Returns the Glyph mapped to given name.

Here is the caller graph for this function:

◆ getGlyphBounds() [1/2]

AABBox com.jogamp.graph.font.Font.getGlyphBounds ( final CharSequence  string)

Try using getGlyphBounds(CharSequence, AffineTransform, AffineTransform) to reuse AffineTransform instances.

Here is the caller graph for this function:

◆ getGlyphBounds() [2/2]

AABBox com.jogamp.graph.font.Font.getGlyphBounds ( final CharSequence  string,
final AffineTransform  tmp1,
final AffineTransform  tmp2 
)

Returns accurate bounding box by taking each glyph's font em-sized bounding box into account.

Glyph bounds is based on each glyph's bounding box and ‘hhea’ composed line height.

Parameters
stringstring text
tmp1temp AffineTransform to be reused
tmp2temp AffineTransform to be reused
Returns
the bounding box of the given string in font em-size [0..1]
See also
getGlyphBoundsFU(CharSequence)
#getGlyphShapeBounds(CharSequence)
getMetricBounds(CharSequence)

◆ getGlyphBoundsFU() [1/2]

AABBox com.jogamp.graph.font.Font.getGlyphBoundsFU ( final CharSequence  string)

Try using getGlyphBoundsFU(CharSequence, AffineTransform, AffineTransform) to reuse AffineTransform instances.

Here is the caller graph for this function:

◆ getGlyphBoundsFU() [2/2]

AABBox com.jogamp.graph.font.Font.getGlyphBoundsFU ( final CharSequence  string,
final AffineTransform  tmp1,
final AffineTransform  tmp2 
)

Returns accurate bounding box by taking each glyph's font-units sized bounding box into account.

Glyph bounds is based on each glyph's bounding box and ‘hhea’ composed line height.

Parameters
stringstring text
tmp1temp AffineTransform to be reused
tmp2temp AffineTransform to be reused
Returns
the bounding box of the given string in font-units [0..1]
See also
getGlyphBounds(CharSequence)

◆ getGlyphCodepoint()

char com.jogamp.graph.font.Font.getGlyphCodepoint ( final String  name)

Returns the Glyph (unicode) codepoint symbol mapped to given Glyph name.

◆ getGlyphCount()

int com.jogamp.graph.font.Font.getGlyphCount ( )

Returns number of Glyph IDs available, i.e.

retrievable via getGlyph(int) [0..count).

◆ getGlyphID()

int com.jogamp.graph.font.Font.getGlyphID ( final char  codepoint)

Returns the Glyph ID mapped to given UTF16 (unicode) codepoint symbol.

Here is the caller graph for this function:

◆ getGlyphShapeBounds() [1/2]

AABBox com.jogamp.graph.font.Font.getGlyphShapeBounds ( final AffineTransform  transform,
final CharSequence  string 
)

Returns accurate bounding box by taking each glyph's font em-sized OutlineShape into account.

Glyph shape bounds is based on each glyph's OutlineShape and ‘hhea’ composed line height.

This method is only exposed to validate the produced OutlineShape against getGlyphBounds(CharSequence).

Parameters
transformoptional given transform
stringstring text
Returns
the bounding box of the given string in font-units [0..1]
See also
#getGlyphShapeBounds(CharSequence)
getGlyphBounds(CharSequence)
getMetricBounds(CharSequence)
Here is the caller graph for this function:

◆ getGlyphShapeBounds() [2/2]

AABBox com.jogamp.graph.font.Font.getGlyphShapeBounds ( final AffineTransform  transform,
final CharSequence  string,
final AffineTransform  tmp1,
final AffineTransform  tmp2 
)

Returns accurate bounding box by taking each glyph's font em-sized OutlineShape into account.

Glyph shape bounds is based on each glyph's OutlineShape and ‘hhea’ composed line height.

This method is only exposed to validate the produced OutlineShape against getGlyphBounds(CharSequence).

Parameters
transformoptional given transform
stringstring text
tmp1temp AffineTransform to be reused
tmp2temp AffineTransform to be reused
Returns
the bounding box of the given string in font-units [0..1]
See also
#getGlyphShapeBounds(CharSequence)
getGlyphBounds(CharSequence)
getMetricBounds(CharSequence)

◆ getLineHeight()

float com.jogamp.graph.font.Font.getLineHeight ( )

Returns line height, baseline-to-baseline in em-size [0..1], composed from ‘hhea’ table entries.

  return ascent - descent + linegap;

or

  // lineGap positive value
  // descent negative value
  // ascent positive value
  return ascent - descent + linegap;
See also
Metrics::getAscent()
Metrics::getDescent()
Metrics::getLineGap()
Here is the caller graph for this function:

◆ getLineHeightFU()

int com.jogamp.graph.font.Font.getLineHeightFU ( )

Returns line height, baseline-to-baseline in font-units, composed from ‘hhea’ table entries.

  return ascent - descent + linegap;

or

  // lineGap positive value
  // descent negative value
  // ascent positive value
  return ascent - descent + linegap;
See also
Metrics::getAscentFU()
Metrics::getDescentFU()
Metrics::getLineGapFU()

◆ getMetricBounds()

AABBox com.jogamp.graph.font.Font.getMetricBounds ( final CharSequence  string)

Returns metric-bounds in font em-size.

Metric bounds is based on the hmtx table's advance of each glyph and ‘hhea’ composed line height.

For accurate layout consider using getGlyphBounds(CharSequence).

See also
getMetricBoundsFU(CharSequence)
getGlyphBounds(CharSequence)
#getGlyphShapeBounds(CharSequence)
Here is the caller graph for this function:

◆ getMetricBoundsFU()

AABBox com.jogamp.graph.font.Font.getMetricBoundsFU ( final CharSequence  string)

Returns metric-bounds in font-units.

Metric bounds is based on the hmtx table's advance of each glyph and ‘hhea’ composed line height.

For accurate layout consider using getGlyphBoundsFU(CharSequence).

See also
getMetricBounds(CharSequence)
getGlyphBoundsFU(CharSequence)
Here is the caller graph for this function:

◆ getMetrics()

Metrics com.jogamp.graph.font.Font.getMetrics ( )
Here is the caller graph for this function:

◆ getName()

String com.jogamp.graph.font.Font.getName ( final int  nameIndex)

◆ getUTF16String() [1/2]

static String com.jogamp.graph.font.Font.getUTF16String ( final char  codepoint)
static

Returns UTF-16 representation of the specified (unicode) codepoint symbol like Character#toChars(int) or Character#toString().

The returned string can be inserted in any text.

Parameters
codepointthe (unicode) codepoint symbol
Returns
the Java String conforming result

Definition at line 338 of file Font.java.

◆ getUTF16String() [2/2]

String com.jogamp.graph.font.Font.getUTF16String ( final String  name)

Returns UTF-16 representation of the specified Glyph name using getGlyphCodepoint(String) and getUTF16String(char).

The returned string can be inserted in any text.

Parameters
codepointthe (unicode) codepoint symbol
Returns
the Java String conforming result

◆ hashCode()

int com.jogamp.graph.font.Font.hashCode ( )

Returns the hash code based on NAME_UNIQUNAME.

◆ isPrintableChar()

boolean com.jogamp.graph.font.Font.isPrintableChar ( final char  c)
Here is the caller graph for this function:

◆ processString() [1/3]

AABBox com.jogamp.graph.font.Font.processString ( final Font.GlyphVisitor  visitor,
final AffineTransform  transform,
final CharSequence  string 
)

Try using processString(GlyphVisitor, AffineTransform, CharSequence, AffineTransform, AffineTransform) to reuse AffineTransform instances.

See also
#processString(GlyphVisitor, AffineTransform, CharSequence, AffineTransform, AffineTransform)
Here is the caller graph for this function:

◆ processString() [2/3]

AABBox com.jogamp.graph.font.Font.processString ( final Font.GlyphVisitor  visitor,
final AffineTransform  transform,
final CharSequence  string,
final AffineTransform  temp1,
final AffineTransform  temp2 
)

Visit each Glyph and perhaps its OutlineShape of the string with the Font.GlyphVisitor while passing the progressed AffineTransform.

The processed shapes are in font em-size [0..1], but can be adjusted with the given transform, progressed and passed to the visitor.

Parameters
visitorhandling each Font.Glyph and perhaps its OutlineShape in font em-size [0..1] and the given AffineTransform
transformoptional given transform for size and position
fontthe target Font
stringstring text
temp1temporary AffineTransform storage, mandatory
temp2temporary AffineTransform storage, mandatory
Returns
the bounding box of the given string by taking each glyph's font em-sized [0..1] OutlineShape into account.
See also
#processString(GlyphVisitor, AffineTransform, CharSequence)

◆ processString() [3/3]

void com.jogamp.graph.font.Font.processString ( final Font.GlyphVisitor2  visitor,
final CharSequence  string 
)

Visit each Glyph and perhaps its OutlineShape of the string with the constrained Font.GlyphVisitor2.

The processed shapes are in font em-size [0..1].

Parameters
visitorhandling each Font.Glyph and perhaps its OutlineShape in font em-size [0..1]
stringstring text

◆ toString()

String com.jogamp.graph.font.Font.toString ( )

Returns getFullFamilyName().

Here is the caller graph for this function:

Member Data Documentation

◆ NAME_COPYRIGHT

final int com.jogamp.graph.font.Font.NAME_COPYRIGHT = 0
static

font name indices for name table

Definition at line 63 of file Font.java.

◆ NAME_DESIGNER

final int com.jogamp.graph.font.Font.NAME_DESIGNER = 9
static

Definition at line 70 of file Font.java.

◆ NAME_FAMILY

final int com.jogamp.graph.font.Font.NAME_FAMILY = 1
static

Definition at line 64 of file Font.java.

◆ NAME_FULLNAME

final int com.jogamp.graph.font.Font.NAME_FULLNAME = 4
static

Definition at line 67 of file Font.java.

◆ NAME_MANUFACTURER

final int com.jogamp.graph.font.Font.NAME_MANUFACTURER = 8
static

Definition at line 69 of file Font.java.

◆ NAME_SUBFAMILY

final int com.jogamp.graph.font.Font.NAME_SUBFAMILY = 2
static

Definition at line 65 of file Font.java.

◆ NAME_UNIQUNAME

final int com.jogamp.graph.font.Font.NAME_UNIQUNAME = 3
static

Definition at line 66 of file Font.java.

◆ NAME_VERSION

final int com.jogamp.graph.font.Font.NAME_VERSION = 5
static

Definition at line 68 of file Font.java.


The documentation for this interface was generated from the following file: