3D Text: improvements to vertical alignment

They way Blender handles vertical alignment is very buggy:

- Top-Base: It works perfectly.

- Bottom: It is actually bottom-baseline,
  and it fails when line size is != 1.0 when working with text boxes.

- Top: Poorly implemented, it should use font's ascent
  (recommended distance from baseline),
  so it has room for accents,
  but it's not one line distance far from the origin (as it is now).

- Center: Poorly implemented.
  This is tricky since there is no silver bullet.

To clear this situation I created a new option (Bottom-Baseline),
and addressed the issues above.
I'm getting the ascent and descent from freetype2,
and use this for padding above/below the text.
Also for vertically centering the text.
This commit is contained in:
Dalai Felinto
2018-09-05 11:21:12 +10:00
committed by Campbell Barton
parent 053669e4ae
commit 312af01fb4
6 changed files with 83 additions and 30 deletions

View File

@@ -398,12 +398,13 @@ class DATA_PT_paragraph_alignment(CurveButtonsPanelText, Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = False
layout.use_property_split = True
text = context.curve
layout.row().prop(text, "align_x", expand=True)
layout.row().prop(text, "align_y", expand=True)
col = layout.column()
col.prop(text, "align_x", text="Horizontal")
col.prop(text, "align_y", text="Vertical")
class DATA_PT_paragraph_spacing(CurveButtonsPanelText, Panel):