Interface GlyphOutlines


public interface GlyphOutlines
The outlines of the glyphs a ShapedText names, for a writer that draws text as text rather than as pixels: a PDF page keeps each glyph as its outline and maps it back to the characters it stands for.

A shaped run names its face by a number only the ruler that shaped it understands (ShapedText.Run.faceId()); the backend that installed that ruler is the one that can turn the number back into a face, so it implements this. Optional: a backend that has none leaves it out, and a document then draws a run it cannot outline from its characters' pictures where it has them, and not at all where it has none, with a warning.

UI thread only, as the ruler is: the faces are the ruler's.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    A glyph drawn in place of a character.
    static final record 
    A picture drawn in place of a character: a colour emoji's strike.
    static interface 
    One thing a glyphless cluster draws.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final GlyphOutlines
    A source that knows no face.
  • Method Summary

    Modifier and Type
    Method
    Description
    cluster(String characters, Font font)
    What draws the characters of a cluster a shaped run left without a glyph (ShapedText.NO_GLYPH): a colour emoji's picture, or a glyph of the face the screen would fall back to, each placed one after the other from the cluster's x.
    faceName(int faceId)
     
    static void
    Installs a backend's source where a document reads it; called by BackendServices.install().
    boolean
    isSyntheticBold(int faceId)
     
    boolean
    outline(int faceId, int glyphId, Path2D.Visitor out)
    Draws a glyph's outline in the face's own units, y growing up from the baseline, as the font file has it: contours whose winding is the non-zero rule's, curves as curves.
    When no face this source shapes with is still loading.
    static void
    Takes back a source installed by install(limn.backend.spi.GlyphOutlines), at the backend's shutdown; another one installed since stays.
    int
    unitsPerEm(int faceId)
     
  • Field Details

    • NONE

      static final GlyphOutlines NONE
      A source that knows no face.
  • Method Details

    • unitsPerEm

      int unitsPerEm(int faceId)
      Parameters:
      faceId - a face number from a shaped run
      Returns:
      the face's units per em, or 0 when this source does not know the face (one evicted since the run was shaped, or one from another ruler)
    • faceName

      String faceName(int faceId)
      Parameters:
      faceId - a face number from a shaped run
      Returns:
      the face's name, for the document's font resources; "" for an unknown face
    • isSyntheticBold

      boolean isSyntheticBold(int faceId)
      Parameters:
      faceId - a face number from a shaped run
      Returns:
      whether the face is drawn bold by thickening a regular one, which a writer reproduces by stroking each outline as well as filling it
    • outline

      boolean outline(int faceId, int glyphId, Path2D.Visitor out)
      Draws a glyph's outline in the face's own units, y growing up from the baseline, as the font file has it: contours whose winding is the non-zero rule's, curves as curves.
      Parameters:
      faceId - a face number from a shaped run
      glyphId - a glyph of that face
      out - receives the outline
      Returns:
      whether the face is known; a known glyph with no ink (a space) draws nothing and answers true
    • cluster

      List<GlyphOutlines.Piece> cluster(String characters, Font font)
      What draws the characters of a cluster a shaped run left without a glyph (ShapedText.NO_GLYPH): a colour emoji's picture, or a glyph of the face the screen would fall back to, each placed one after the other from the cluster's x.
      Parameters:
      characters - the cluster's characters
      font - the run's font
      Returns:
      the pieces in order; empty when nothing draws them
    • settled

      default CompletionStage<Void> settled()
      When no face this source shapes with is still loading. A face the shaper asked for while a document was recorded (a script's fallback, loaded in the background on its first need) was drawn as boxes for that recording; a document waits on this and records its pages again, where a window simply draws its next frame.
      Returns:
      a stage completed on the UI thread once nothing is loading; completed already when nothing is, which the default answers
    • install

      static void install(GlyphOutlines outlines)
      Installs a backend's source where a document reads it; called by BackendServices.install().
      Parameters:
      outlines - the backend's source
    • uninstall

      static void uninstall(GlyphOutlines outlines)
      Takes back a source installed by install(limn.backend.spi.GlyphOutlines), at the backend's shutdown; another one installed since stays.
      Parameters:
      outlines - the source that was installed