UI: Improved Initial Vfont Sizes #109228
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#109228
Loading…
Reference in New Issue
No description provided.
Delete Branch "Harley/blender:vfontsize"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Better consistency between initial text object sizes by using Cap
height instead of maximum bounding box height.
Text objects can obviously be scaled to any size. But the initial sizes, when the text is first added, create a lot of variation in the visual size of different fonts. With Blender 4.0 it might be a nice time to improve this.
This problem occurs now because we base the initial scale on the maximum top and bottom of all the glyphs in the font, which is not a normal metric for this use. If you start with two identically-designed fonts that just have coverage of lower Latin and then add extra characters outside of that range to one then it will be shown as smaller in Blender. This is because it is more likely to contain characters, like symbols, that might extend further above or below the other characters. This will increase the maximal vertical range and result in a smaller scale.
The most normal metric to keep different fonts at nearly the same size is to use Cap height, or the height of a capital letter above the baseline. Specifically it is the height of flat capitals (like H or I), rather than rounded (O) or pointed (A). So the informal definition is the height of a capital H.
This PR refactors the scale calculations to use Cap height. But then scales the result so that our default font is the same height as it is today. This also means that most sane fonts - that have capitals that take up the space between baseline and top of the em-square are also that same height.
Following shows an assortment of fonts at initial sizes in current code:
The following shows the same fonts with this PR.:
You should notice that the second image has improved consistency. It is not perfect though, as that is impossible, because font designers are free to make glyphs of any size within their design sizes. But you should notice that for most of the "normal" fonts the tops of the "f" are perfectly aligned.
This PR first checks to see if the font itself actually defines a "cap height" metric within it. If not, this falls back to measuring the height of an "H". And if the font does not contain an "H" then it uses 70% of design height.
Note that with this code change VFontData->em_height would always be exactly 1.0f. As in the font is 1em high and then scaled by VFontData->scale. This em_height was never needed but sometimes had a non-one value because of the current wonky calculations. So this PR removes it, simplifying some other calculations.
I don't know too much about this area, but the description makes sense, and the code change looks reasonable to me. 4.0 does seem like a nice time to change this.
@ideasman42 - What do you think of this?
On the one hand it would be nice to finally clean this up. Users could (generally) replace one normal font with one of similar design and have them be the same height.
On the other hand we end up with small font size differences for files made prior to 4.0. Is it worth the hassle or is 4.0 the first and best chance to do this? Not sure.
d67265957c
to70d810682f
How complex would it be to add versioning that scales the text height by the difference in the new behavior? Then the different results in 4.0 argument wouldn't apply. That breaking change does make me a bit hesitant about this too actually.
Actually I also don't like having this change of behavior between versions for so little gain.
Pull request closed