-
I'd like to write several text blocks, but I want them to be positioned next to where the other text block was written. Because I don't know what the length or font size of each text block will be, I need ImageSharp to tell me what the bounds were for the text it just rendered with:
Is it possible to get this information somehow from ImageSharp? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
https://docs.sixlabors.com/articles/fonts/gettingstarted.html the first example for our getting start docs cover this exact sort of case. var size = TextMeasurer.MeasureAdvance(parsed.ParsedString, new RichTextOptions(normalFontQnText) {
Origin = new Vector2(810, 800),
LayoutMode = LayoutMode.HorizontalTopBottom,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
TextAlignment = TextAlignment.Start,
WrappingLength = 900,
TextRuns = parsed.TextRuns,
} ); is basically what your looking for. PS this question would have been better asked in ImageSharp.Drawing as its a |
Beta Was this translation helpful? Give feedback.
https://docs.sixlabors.com/articles/fonts/gettingstarted.html the first example for our getting start docs cover this exact sort of case.
is basically what your looking for.
PS this question would have been better asked in ImageSharp.Drawing as its a
DrawXXX
API or Fonts as its about text metadata.