Class TextLayout

  • Direct Known Subclasses:
    AWTTextLayout

    public class TextLayout
    extends Object
    A helper to process text position according to a Horizontal, Vertical, text height and width.
    Author:
    Martin Pernollet
    • Constructor Detail

      • TextLayout

        public TextLayout()
    • Method Detail

      • align

        public Coord3d align​(float textWidth,
                             float textHeight,
                             Horizontal horizontal,
                             Vertical vertical,
                             Coord2d offset,
                             Coord3d screen)
        Compute final text position on screen according to the layout parameters and initial screen position.
        Parameters:
        textWidth - width of the text in pixel
        textHeight - height of the text font in pixel
        horizontal - horizontal alignment
        vertical - vertical alignment
        offset - an (x,y) offset to apply to the base position once X and Y alignment are processed
        screen - base 2D position of the text on screen before applying layout (Z dimension is used to indicate how far is the text in the 3D scene, given as a ratio between the near and far clipping plane of the camera)
      • align

        public Coord3d align​(float textWidth,
                             float textHeight,
                             Horizontal horizontal,
                             Vertical vertical,
                             Coord3d screen)
        Compute final text position on screen according to the layout parameters and initial screen position.
        Parameters:
        textWidth - width of the text in pixel
        textHeight - height of the text font in pixel
        horizontal - horizontal alignment
        vertical - vertical alignment
        screen - base 2D position of the text on screen before applying layout (Z dimension is used to indicate how far is the text in the 3D scene, given as a ratio between the near and far clipping plane of the camera)
      • computeXAlign

        public float computeXAlign​(float textWidth,
                                   Horizontal horizontal,
                                   Coord3d screenPosition,
                                   float x)
      • computeYAlign

        public float computeYAlign​(float textHeight,
                                   Vertical vertical,
                                   Coord3d screenPosition,
                                   float y)