Class ContourPlot.SignedDistanceCharacters

  • Enclosing class:
    ContourPlot

    public static class ContourPlot.SignedDistanceCharacters
    extends java.lang.Object
    The SignedDistanceCharacters class comprises signed distance fields of a set of characters. A signed distance field is an image in which each pixel encodes the distance to the nearest edge. Such an image of a character glyph allows for efficient rendering of text with arbitrary size and rotation using alpha testing and blending. For more details read this paper dl.acm.org/citation.cfm?id=1281665.

    The signed distance fields for each character are stored in a single image alongside a lookup table for the bounding rectangles for each character within that image. The set of characters used is defined in CHARACTERS which is a String sorted by char value ascending.

    Since the process of computing a SignedDistanceCharacters object is quite time consuming, there are pre-computed SignedDistanceCharacters instances for the Ubuntu Mono font used by JPlotter (see ContourPlot.FontProvider) which are statically loaded from files. These are located in .../resources/font/ alongside the corresponding true type font files. Similar to the ContourPlot.FontProvider.getUbuntuMono(float, int) the #getUbuntuMonoSDC(int) method can be used to access the pre-computed SignedDistanceCharacters.

    Author:
    hageldave