Comments (2)
When the TabWidth is set to 0, any line containing a tab will be cut off following the tab.
This is a bug and I've split this out into issue #32
When the TabWidth is greater than 1, the actual drawn TabWidth will be 1 too small.
The way the library is currently setup is that tabs work as a series of Tab stops at tab width boundaries, with a minimum width of one space.
I'll layout a couple of examples to illustrate: where 'X' = 5px & space = 10px and tabwidth = 4 (measured in space widths) therefore tabs will stop every 40px.
so take the text 'x' 'x' 'x' '\t' 'x'
for example based on the measurements above it would end up as 45px wide, this would breaking down to this:
- 5px for the first
x
(moving us to 5px along) - 5px for the second
x
(moving us to 10px along) - 5px for the third
x
(moving us to 15px along) - 25px for the
\t
(moving us along to 40px) as tabs move >= space width but stopping at a 'tab stop' - 5px for last
x
(moving us to 45px)
now on the other hand 'x' 'x' 'x' '\t' '\t' 'x'
would end up as 85px;
- 5px for the first
x
(moving us to 5px along) - 5px for the second
x
(moving us to 10px along) - 5px for the third
x
(moving us to 15px along) - 25px for the
\t
(moving us along to 40px) as tabs move >= space width but stopping at a 'tab stop' - 40px for the
\t
(moving us along to 80px) moveing us one space forward then continuing forward until it hits a tab stop - 5px for last
x
(moving us to 85px)
Hope the clarifies how calculated tab widths end up being calculated.
Basically its not directly equatable of 1 tab character will always be the same exact width.
In conclusion tabs are currently working as designed (except for bugs as noted), and this tab rendering mechanism is consistent with other text rendering software, Word does it, even Notepad does.
Measuring strings starting or ending with a tab ignores those tabs.
This is a bug and I've split this out into issue #33
from fonts.
So i'm closing this and will track the other 2 issues separately
from fonts.
Related Issues (20)
- TextLayout.ProcessText throws an unhandled exception while using Style Script font with specific text HOT 7
- TextMeasurer.TryMeasureCharacterBounds exception on Arial font with specific RTL text HOT 1
- Recent commit "Enumerate available fonts through the native API on macOS" breaks UWP native build. HOT 32
- SystemFontCollection doesn't list open type font.
- Race-condition when writing 32-bit png images with text in parallel. HOT 14
- MAUI.Android error: cant use FontCollection() add a font stream HOT 3
- Problem with wrapping long words HOT 3
- DrawText throws System.NotSupportedException: Specified method is not supported. HOT 14
- Problem with font "PMINGLIU.ttf", InvalidFontTableException: 'Unable to find table'
- Problem with font "Sumana", wrong left parenthesis character HOT 2
- DrawText with horizontal alignment doesn't appear to work properly HOT 6
- DrawText generates text with DFKai-SB or KaiU fonts differently than expected HOT 18
- TextMeasurer.Measure returns incorrect width HOT 4
- TextMeasurer.MeasureSize: Incorrect text height calculation HOT 5
- Nuget package for SixLabors.Fonts 1.0.0 fails to Mutate the image. HOT 1
- Wrong character orientation when drawing brackets HOT 2
- Problem with font "BNazanin.ttf", System.NullReferenceException
- Inter Variable rendering incorrectly HOT 5
- TextRenderer.RenderTextTo throws ArgumentOutOfRangeException when use WordBreaking.BreakAll and small WrappingLength
- Issue 367 introduced lingering whitespaces HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fonts.