|
| GlyphArrangement () |
| Creates an empty arrangement. More...
|
|
| GlyphArrangement (const GlyphArrangement &)=default |
|
| GlyphArrangement (GlyphArrangement &&)=default |
|
| ~GlyphArrangement ()=default |
| Destructor. More...
|
|
void | addCurtailedLineOfText (const Font &font, const String &text, float x, float y, float maxWidthPixels, bool useEllipsis) |
| Adds a line of text, truncating it if it's wider than a specified size. More...
|
|
void | addFittedText (const Font &font, const String &text, float x, float y, float width, float height, Justification layout, int maximumLinesToUse, float minimumHorizontalScale=0.0f) |
| Tries to fit some text within a given space. More...
|
|
void | addGlyph (const PositionedGlyph &) |
| Appends a custom glyph to the arrangement. More...
|
|
void | addGlyphArrangement (const GlyphArrangement &) |
| Appends another glyph arrangement to this one. More...
|
|
void | addJustifiedText (const Font &font, const String &text, float x, float y, float maxLineWidth, Justification horizontalLayout, float leading=0.0f) |
| Adds some multi-line text, breaking lines at word-boundaries if they are too wide. More...
|
|
void | addLineOfText (const Font &font, const String &text, float x, float y) |
| Appends a line of text to the arrangement. More...
|
|
const PositionedGlyph * | begin () const |
|
void | clear () |
| Clears all text from the arrangement and resets it. More...
|
|
void | createPath (Path &path) const |
| Converts the set of glyphs into a path. More...
|
|
void | draw (const Graphics &) const |
| Draws this glyph arrangement to a graphics context. More...
|
|
void | draw (const Graphics &, AffineTransform) const |
| Draws this glyph arrangement to a graphics context. More...
|
|
const PositionedGlyph * | end () const |
|
int | findGlyphIndexAt (float x, float y) const |
| Looks for a glyph that contains the given coordinate. More...
|
|
Rectangle< float > | getBoundingBox (int startIndex, int numGlyphs, bool includeWhitespace) const |
| Finds the smallest rectangle that will enclose a subset of the glyphs. More...
|
|
PositionedGlyph & | getGlyph (int index) noexcept |
| Returns one of the glyphs from the arrangement. More...
|
|
int | getNumGlyphs () const noexcept |
| Returns the total number of glyphs in the arrangement. More...
|
|
void | justifyGlyphs (int startIndex, int numGlyphs, float x, float y, float width, float height, Justification justification) |
| Justifies a set of glyphs within a given space. More...
|
|
void | moveRangeOfGlyphs (int startIndex, int numGlyphs, float deltaX, float deltaY) |
| Shifts a set of glyphs by a given amount. More...
|
|
GlyphArrangement & | operator= (const GlyphArrangement &)=default |
|
GlyphArrangement & | operator= (GlyphArrangement &&)=default |
|
void | removeRangeOfGlyphs (int startIndex, int numGlyphs) |
| Removes a set of glyphs from the arrangement. More...
|
|
void | stretchRangeOfGlyphs (int startIndex, int numGlyphs, float horizontalScaleFactor) |
| Expands or compresses a set of glyphs horizontally. More...
|
|
|
void | addLinesWithLineBreaks (const String &, const Font &, float x, float y, float width, float height, Justification) |
|
void | drawGlyphUnderline (const Graphics &, const PositionedGlyph &, int, AffineTransform) const |
|
int | fitLineIntoSpace (int start, int numGlyphs, float x, float y, float w, float h, const Font &, Justification, float minimumHorizontalScale) |
|
int | insertEllipsis (const Font &, float maxXPos, int startIndex, int endIndex) |
|
void | splitLines (const String &, Font, int start, float x, float y, float w, float h, int maxLines, float lineWidth, Justification, float minimumHorizontalScale) |
|
void | spreadOutLine (int start, int numGlyphs, float targetWidth) |
|
A set of glyphs, each with a position.
You can create a GlyphArrangement, text to it and then draw it onto a graphics context. It's used internally by the text methods in the Graphics class, but can be used directly if more control is needed.
- See also
- Font, PositionedGlyph
@tags{Graphics}
void juce::GlyphArrangement::addCurtailedLineOfText |
( |
const Font & |
font, |
|
|
const String & |
text, |
|
|
float |
x, |
|
|
float |
y, |
|
|
float |
maxWidthPixels, |
|
|
bool |
useEllipsis |
|
) |
| |
Adds a line of text, truncating it if it's wider than a specified size.
This is the same as addLineOfText(), but if the line's width exceeds the value specified in maxWidthPixels, it will be truncated using either ellipsis (i.e. dots: "..."), if useEllipsis is true, or if this is false, it will just drop any subsequent characters.
Tries to fit some text within a given space.
This does its best to make the given text readable within the specified rectangle, so it's useful for labelling things.
If the text is too big, it'll be squashed horizontally or broken over multiple lines if the maximumLinesToUse value allows this. If the text just won't fit into the space, it'll cram as much as possible in there, and put some ellipsis at the end to show that it's been truncated.
A Justification parameter lets you specify how the text is laid out within the rectangle, both horizontally and vertically.
The minimumHorizontalScale parameter specifies how much the text can be squashed horizontally to try to squeeze it into the space. If you don't want any horizontal scaling to occur, you can set this value to 1.0f. Pass 0 if you want it to use the default value.
- See also
- Graphics::drawFittedText
Adds some multi-line text, breaking lines at word-boundaries if they are too wide.
This will add text to the arrangement, breaking it into new lines either where there is a new-line or carriage-return character in the text, or where a line's width exceeds the value set in maxLineWidth.
Each line that is added will be laid out using the flags set in horizontalLayout, so the lines can be left- or right-justified, or centred horizontally in the space between x and (x + maxLineWidth).
The y coordinate is the position of the baseline of the first line of text - subsequent lines will be placed below it, separated by a distance of font.getHeight() + leading.
void juce::GlyphArrangement::addLineOfText |
( |
const Font & |
font, |
|
|
const String & |
text, |
|
|
float |
x, |
|
|
float |
y |
|
) |
| |
Appends a line of text to the arrangement.
This will add the text as a single line, where x is the left-hand edge of the first character, and y is the position for the text's baseline.
If the text contains new-lines or carriage-returns, this will ignore them - use addJustifiedText() to add multi-line arrangements.