Reducing cubic bezier to quadratic

Discussions about the development of TrueType and OpenType fonts.
Post Reply
jamadagni
Posts: 67
Joined: Fri Jun 17, 2011 4:10 am
Location: 11 N 78 E

Reducing cubic bezier to quadratic

Post by jamadagni » Thu Jan 03, 2013 12:49 am

Hello.

FC has to convert cubic beziers to a series of quadratics when it imports postscript-based vector images. In general, this conversion is only an approximation as most cubic beziers are not exactly representable by one or even more than one quadratic. http://fontforge.org/bezier.html#ps2ttf discusses the problem and notes that by splitting at even times along the cubic, one can achieve conciseness because one can avoid specifying the on-curve point halfway between two off-curve points. (The Fontforge author says he cannot prove it but it is elementary enough if one understands the de Casteljau algorithm.)

Now my question is, what is an appropriate error bound that can be permitted as tolerance for the reduction from cubic to quadratic, given that we are handling splines defined in terms of integer coordinates scaled to an em-grid?

Specifically what error bound does FC use when importing postscript outlines?

Thanks!

(P.S.: I hope I have posted this in the appropriate sub-forum as it concerns the internals of fonts.)
Shriramana Sharma

Erwin Denissen
Moderator
Moderator
Posts: 6648
Joined: Fri Oct 04, 2002 12:41 am
Location: De Bilt, The Netherlands
Contact:

Re: Reducing cubic bezier to quadratic

Post by Erwin Denissen » Wed Jan 23, 2013 3:18 pm

There is no easy answer. You don't want to end up with too many points, but you do want an accurate conversion. I think FontCreator does a nice job, but there is always room for improvement.
Erwin Denissen
High-Logic
Proven Font Technology

jamadagni
Posts: 67
Joined: Fri Jun 17, 2011 4:10 am
Location: 11 N 78 E

Re: Reducing cubic bezier to quadratic

Post by jamadagni » Thu Jan 24, 2013 8:08 am

Erwin Denissen wrote:There is no easy answer. You don't want to end up with too many points, but you do want an accurate conversion. I think FontCreator does a nice job, but there is always room for improvement.
Hi Erwin and thanks for your reply. I was not trying to comment on the quality of FC's conversion of cubics to quadratics (I haven't tested it specifically) but was only wondering if I could know what error bound it uses. Is it possible for you to share that bit of info? Thanks.
Shriramana Sharma

Erwin Denissen
Moderator
Moderator
Posts: 6648
Joined: Fri Oct 04, 2002 12:41 am
Location: De Bilt, The Netherlands
Contact:

Re: Reducing cubic bezier to quadratic

Post by Erwin Denissen » Thu Jan 24, 2013 10:10 am

It is not just a number, as it involves a formula. But if it helps, the constant used in the formula is 2.
Erwin Denissen
High-Logic
Proven Font Technology

jamadagni
Posts: 67
Joined: Fri Jun 17, 2011 4:10 am
Location: 11 N 78 E

Re: Reducing cubic bezier to quadratic

Post by jamadagni » Thu Jan 24, 2013 11:26 am

Erwin Denissen wrote:It is not just a number, as it involves a formula. But if it helps, the constant used in the formula is 2.
H
Hi thanks -- I have the de Casteljau formula implemented, no problem. From your statement above, I will assume that 2 em units is the tolerance used. Thanks.
Shriramana Sharma

michel22
Posts: 9
Joined: Sat Jan 09, 2016 12:19 pm

Re: Reducing cubic bezier to quadratic

Post by michel22 » Sun Sep 18, 2016 3:39 am

Hi

i read in the changelog that fontcreator support copy ( inkscape / illustrator) / paste ( fontcreator). Even the sentences speak about SVG i really think there ll be differences in clipboard between the copy fonctionnalities when using Inkscape or Illustrator to paste inside fontcreator !! Illustrator and all Adobe software choose after use microsoft OLE to use their own implementation protocol beetween their own tools ( CC support link ) . Adobe documentation is really great about use illustrator work in firework using export/import or copy/paste beetwwen the two software .

For illustrator / inkscape which are the behaviour of fontcreator about :
- mathematic algo bezier: cubic "2 control point" ( SVG, illustrator) / quadratic "1 control point" (ttf) ?
- svg path : absolute( coordinate) / relative ( distance) ?
- last svg version number supported ?
- glyph in fill mode only
-the direction of the inner/outer outline glyph inside vector tool ?
-alignement : position , scale of of original glyph ?
-resolution , boundingbox

wich is the best result / best-easy workflow for font when mix thoses options above ?
-copy or import
-inkscape or illiustrator


fontcreator support copy paste vector from vector drwing tool like inskscape and illustrator and also import.
It is strange the last line contain Scalable Vector Graphic but no extension appear after like ( *.svg , *.svgz ) .
fc_importnoSVG.png
fc_importnoSVG.png (18.32 KiB) Viewed 895 times

It is really nice to let end user test each new version of fontcreator since i already test previous version !!!


Regard's

NB : in a font a "o" glyph ="circle" use same number of control points so quadratic ll have more points and both could be rasterize flatten or outline.
object type Text is convert to raster using " Rasterize" in photoshop and Create Outline in illustrator !!

adobe illustrator grid and font setting 1 , pixel perfection , artboard, artboard & font
Last edited by michel22 on Sun Sep 18, 2016 8:48 pm, edited 1 time in total.

michel22
Posts: 9
Joined: Sat Jan 09, 2016 12:19 pm

Re: Reducing cubic bezier to quadratic

Post by michel22 » Sun Sep 18, 2016 6:17 pm

Hi
i test the software here some feedback :

-the glyph i use come from ttf file available on the interrnet for free .
-FC when edit it show in bottom panel 54 points ( Square points along path and Circle handle)
---- 2 continuous points can have 2 or 3 continuous handles exist and can be sometines link each others
.....the validation tool see to confirm some issues
------------redundant => need to remove the "point" ( square)
------------off curve extreme coordinate => need to replace "1 point" by "2 points " ( square and circle/handle)
.....optimize remove some "points" SCS ->C and CC->C
-copy twitter glyph from FC to AI show 33 points ( call anchor in AI appear like suqres along path,
......each square have with no exception 2 circle handles , no circle handles are share beetween square or circle )
......in zoom 6400% on the 3 squares are now 2 suqres
......the shape is counter clockwise ( after use custom brush orwidth profile)
.....paste the glyph from AI to FC show that position and scale must be done manually !
I don't succeed to find how to know in fontcreator the external and internal direction of "path outline" ( clock or counter clockwise ) .
I think have information about direction for each segment ( inner outer) is the most import ant thing and share the point of view of this post .


Two questions :
--Is there a way to see visualy direction arrow in Fontcreator ?
--Can i succeed to copy glyph in AI and paste in FC without need to manualy resize scale change position in FC ?

Regard's
Last edited by michel22 on Sun Sep 18, 2016 6:25 pm, edited 1 time in total.

Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 6902
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Re: Reducing cubic bezier to quadratic

Post by Bhikkhu Pesala » Sun Sep 18, 2016 6:23 pm

michel22 wrote:I don't succeed to find how to know in fontcreator the external and internal direction of "path outline" ( clock or counter clockwise )
The selected contour's direction is shown in the hintline.
Contour Direction.png
Contour Direction.png (3.24 KiB) Viewed 875 times
My FontsReviews: MainTypeFont CreatorHelpFC11.0 Pro + MT7.0 @ Win10 1703

michel22
Posts: 9
Joined: Sat Jan 09, 2016 12:19 pm

Re: Reducing cubic bezier to quadratic

Post by michel22 » Sun Sep 18, 2016 6:40 pm

Hi

Thank's for your feedback .......

I understand now after test Font Creator that
-one click outside shape convert all shape to edit points mode
-cursor inside close shape convert the mouse cursor to XY translate icon and higlight in red the shape and show us the direction in bottom side .

This is not the same behaviour as illustrator .
It would be nice to be able to see the baseline when viewing the glyph overview. The metric and reference lines is only available when in the glyph edit window (can it contain many "glyph" ? ).

The useful question should be instead read mode to have write mode ....so Is there a way to change the direction clock for each shape that can be contain inside a character in Fontcreator ?

When I see Inkscape font plugin ( video) I hope Fontcreator is the next tool to convert svg to font library .

Regard's
Last edited by Bhikkhu Pesala on Sun Sep 18, 2016 7:18 pm, edited 1 time in total.
Reason: Edited for greater clarity

Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 6902
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Re: Reducing cubic bezier to quadratic

Post by Bhikkhu Pesala » Sun Sep 18, 2016 7:24 pm

michel22 wrote:one click outside shape convert all shape to edit points mode
It takes a double-click to toggle between points mode and contour mode. I think your mouse is defective, which would explain the duplicate posts.
michel22 wrote:The metric and reference lines is only available when in the glyph edit window (can it contain many "glyph" ? ).
More than one glyph can be shown by using the Comparison Toolbar, but only one glyph can be edited at a time.
michel22 wrote:Is there a way to change the direction clock for each shape that can be contain inside a character in Fontcreator ?
There's a Change Direction icon on the toolbar. Select all contours to change their directions all at once.
michel22 wrote:I hope Fontcreator is the next tool to convert svg to font library .
Drag and drop can be used to import multiple images at once. SVG, PDF, or AI images will import very quickly. All you need to do is ensure that the names are in alphabetical order, e.g. from A.svg to Z.svg then drop them all into the "A" glyph in the glyph overview.
My FontsReviews: MainTypeFont CreatorHelpFC11.0 Pro + MT7.0 @ Win10 1703

michel22
Posts: 9
Joined: Sat Jan 09, 2016 12:19 pm

Re: Reducing cubic bezier to quadratic

Post by michel22 » Sun Sep 18, 2016 8:51 pm

Hi Thank's for your reply

A) comparison tool bar
The place is not in the visual menu but under view->Toolbazr ->comparision (F11)

B) Direction icon
fc_clockDirection.png
fc_clockDirection.png (18.42 KiB) Viewed 860 times
C) event behaviour
Yes ...i use a mutitouch wacom tablet with a pen so my mouse button and keyboard key don't have the default OS behaviour




Since fontcreator fullfilled my expectation i have to test now how some svg files icon are manage by Fontcreator during import of those svg files ?
I think the Grid inside fontcreator should becreate in illustrator and inkscape to draw the glyph ?
I already find some information about illustrator but need to remember where i found them ?

Layout for Character

Horizontal reference point ( x=? , y=0)
0
1000

vertical reference point ( y =? , x=0)
WinAscent 1920
CapHeight 1830
x-Height 1760
Baseline 0
windescent 200
regard's

Erwin Denissen
Moderator
Moderator
Posts: 6648
Joined: Fri Oct 04, 2002 12:41 am
Location: De Bilt, The Netherlands
Contact:

Re: Reducing cubic bezier to quadratic

Post by Erwin Denissen » Tue Dec 20, 2016 10:35 am

michel22 wrote:Since fontcreator fullfilled my expectation i have to test now how some svg files icon are manage by Fontcreator during import of those svg files ?
I think the Grid inside fontcreator should becreate in illustrator and inkscape to draw the glyph ?
I already find some information about illustrator but need to remember where i found them ?
With the release of FontCreator 10.1 we've made several improvements to the import and positioning of vector based images. You can change several settings here:
vectorimportoptions.png
vectorimportoptions.png (6.26 KiB) Viewed 560 times
Erwin Denissen
High-Logic
Proven Font Technology

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest