VFont: Corrections to Cursor When on Curve #107307
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#107307
Loading…
Reference in New Issue
No description provided.
Delete Branch "Harley/blender:CurveCursor"
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?
Corrections to transformation and placement of the text cursor when the
text is being deformed by a curve.
When a text object is deformed by a curve the text cursor (caret) needs to be shown at an angle. Unfortunately this transformation isn't done correctly so the top and bottom edges are not aligned correctly and it become non-rectangular. And the angle quite often does not look quite right:
The PR just transforms the cursor correctly so that it remains rectangular after rotation. And it chooses the rotation better, matching nicer on first and last character and to the beginning or end of a selection. Overall it just looks a bit better:
This PR is offered as a much simpler alternative to #107193.
@ -1546,3 +1540,1 @@
f[0] = font_size * (-0.02f * co + ct->xof);
f[1] = font_size * (0.1f * si - (0.25f * co) + ct->yof);
float width = 0.02f;
These can be made
const
.@ -1549,0 +1542,4 @@
float left = ct->xof;
float bottom = ct->yof;
float rotation = ct->rot;
float caret_nudge = 0.0f;
Use term
cursor
instead ofcaret
.There should be an explanation why the nudge is needed, it also seems only to apply to the X axis, so
cursor_offset_x
with a description for why the small amount of X offset is needed (what does it solve?).@ -1558,0 +1577,4 @@
float temp_fl[2];
rotate_v2_v2fl(temp_fl, &ef->textcurs[i][0], -rotation);
ef->textcurs[i][0] = font_size * (left + temp_fl[0]);
ef->textcurs[i][1] = font_size * (bottom + temp_fl[1] - 0.25f);
What does
0.25
represent? Applying an offset after rotation seems strange.May as well assign to a
const
float with a descriptive name.@ideasman42 - I think I have made it easier to follow, including any need for that "nudge"
I put in detailed comments, but there are times when the cursor should align with the character to the right and sometimes to the left, like when there is a selection. if the cursor is at the left edge of a selection is is nice to move it to the edge of the selection rather than straddling it to show more of the selected text.
I am hoping my comments explain that enough. Basically when on a curve the characters are rotated by their bottom left corner. So the cursor's bottom-left corner is similarly in the correct position. If we apply offsets before rotation the cursor moves incorrectly because
rotate_v2_v2fl
rotates around {0,0), so here I am moving the cursor so that the rotation origin is where I want it, rotate, then apply offsets. I think it would be clearer if we had a version ofrotate_v2_v2fl
that could rotate around a different origin than just {0,0}.Without that "0.25" downward movement the cursor would have its bottom point on the baseline, but we want it 75% above and 25% below so lines up better with most fonts that have descenders.
@blender-bot build
28ea3e0af1
toac92a4a9bf
@blender-bot build
@blender-bot build