Debugging Tools?

Get help with FontCreator here. Please do not post feature requests or bug reports here.
Hermes14
Posts: 22
Joined: Mon Jul 10, 2017 9:22 pm

Debugging Tools?

Post by Hermes14 »

Greetings,

Does OTD have, or plan to implement, something along the lines of the following debugging tools:

1) Given a string that produces an unexpected result, one needs to search for the relevant glyph and for the lookups that contain it. For example, VOLT has an Explorer in which one can look for a glyph in GSUB, GPOS, contextuals, and groups (=classes). Not perfect but it has saved this writer enormous amounts of time.

If there is already a way to do this, could not find it.

2) In Preview, we can select features, but not lookups within features. Given a lookup sequence that produces a result, it helps to be able to look at the results step by step. VOLT has its own implementation of this idea; does OTD have, or plan to implement, anything similar in this regard?

Within the OTD paradigm as is, what are some standard practices currently used to debug lookups?

Many thanks in advance for your reply.
Hermes14
Posts: 22
Joined: Mon Jul 10, 2017 9:22 pm

Re: Debugging Tools?

Post by Hermes14 »

Hermes14 wrote: Fri Sep 08, 2017 5:15 pm 2) In Preview, we can select features, but not lookups within features. Given a lookup sequence that produces a result, it helps to be able to look at the results step by step. VOLT has its own implementation of this idea; does OTD have, or plan to implement, anything similar in this regard?
For example, Preview gives the name of the glyph string beneath the preview. But sometimes we need to be able to trace back each glyph through its relevant lookup sequence to its original Unicode input etc...
Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 9873
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Re: Debugging Tools?

Post by Bhikkhu Pesala »

Hermes14 wrote: Fri Sep 08, 2017 5:15 pm1) Given a string that produces an unexpected result, one needs to search for the relevant glyph and for the lookups that contain it.
In the OpenType Designer Preview area, click on the glyph to go to relevant lookup or on the Preview Toolbar to go to the relevant glyph in the Glyph Overview.
My FontsReviews: MainTypeFont CreatorHelpFC15 + MT12.0 @ Win 10 64-bit build 19045.2486
Hermes14
Posts: 22
Joined: Mon Jul 10, 2017 9:22 pm

Re: Debugging Tools?

Post by Hermes14 »

Bhikkhu Pesala wrote: Fri Sep 08, 2017 6:19 pm
Hermes14 wrote: Fri Sep 08, 2017 5:15 pm1) Given a string that produces an unexpected result, one needs to search for the relevant glyph and for the lookups that contain it.
In the OpenType Designer Preview area, click on the glyph to go to relevant lookup or on the Preview Toolbar to go to the relevant glyph in the Glyph Overview.
Excellent feature! Will study this. In conjunction with other possibilities such as the following:

viewtopic.php?f=3&t=7332#p34674
Erwin Denissen wrote: Wed Sep 06, 2017 8:12 pm
Hermes14 wrote: Wed Sep 06, 2017 2:11 pm And from a substitution table in the lookups tree, perhaps add a way to see what contextual fields if any use that table and allow the user to select and jump back to that contextual field under the Feature tree.

Or something along these lines... Does that make sense?
Yes, it makes sense, so I've added it to the to-do list.
..we have the foundations of a good workflow :)
Hermes14
Posts: 22
Joined: Mon Jul 10, 2017 9:22 pm

Re: Debugging Tools?

Post by Hermes14 »

Real life example:

Noto Nastaliq Urdu
It's free - https://www.google.com/get/noto/#nastaliq-aran

In OTD, Preview, enter this Unicode string and select Arabic (arab) from the top left of the features pane: لحمد

Glyph string result appears at the bottom: /LamIni.outD2H/HahMed.inD2outD2MM/MeemMed.inD2outT1/DalFin

Toggle rlig:
Before rlig: HahMed
After rlig: HahMed.inD2outD2MM

Challenge: Find the correct table and lookup(s) which govern the substitution of HahMed with HahMed.inD2outD2MM - there may be intermediate substitutions

What is the most efficient way to do this?

(Clicking on the glyph in Preview takes one to the relevant curs lookup - we want rlig).

(One could export an otlfd file and search but depending on classes etc that could be unwieldy - this should be doable from the GUI).

(Idea: Given a glyph in the resultant glyph string below Preview, come up with a reasonable way to select and see what lookups it participates in. Etc.)

Thank you in advance.
Hermes14
Posts: 22
Joined: Mon Jul 10, 2017 9:22 pm

Re: Debugging Tools?

Post by Hermes14 »

Another example, same font:

sample: ہو
features: curs fina init rlig

Toggle rlig

With rlig on, click on rightmost character in Preview: This takes us to SingleSubstitution33.

Go to Features - RequiredLigatures (rlig) in the left pane.

Challenge: Find a the contextual chain that calls SingleSubstitution33 - I could not find it.

Exported an otlfd to look for clues - no luck.

Spent over an hour trying to solve this within the GUI and text export.

Aside from this font, in my own project - at least five times as many lookups and over a dozen times as many features compared to this one - often need to be able to debug quickly. At the moment, doing this in OTD is very inefficient.

Apologies if this follow-up appears to constitute a gilding of the lily ;-) Kindly take it in the spirit of sharing experiences as the developers continue to think of creative ways to improve functionality. Many thanks.
Erwin Denissen
Moderator
Moderator
Posts: 11108
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Debugging Tools?

Post by Erwin Denissen »

Hermes14 wrote: Fri Sep 08, 2017 9:55 pm Real life example:

Noto Nastaliq Urdu
It's free - https://www.google.com/get/noto/#nastaliq-aran

In OTD, Preview, enter this Unicode string and select Arabic (arab) from the top left of the features pane: لحمد

Glyph string result appears at the bottom: /LamIni.outD2H/HahMed.inD2outD2MM/MeemMed.inD2outT1/DalFin

Toggle rlig:
Before rlig: HahMed
After rlig: HahMed.inD2outD2MM

Challenge: Find the correct table and lookup(s) which govern the substitution of HahMed with HahMed.inD2outD2MM - there may be intermediate substitutions

What is the most efficient way to do this?
Right now best you can do is search within the feature code, which is tedious and there is room for error.
Hermes14 wrote: Fri Sep 08, 2017 9:55 pm (Clicking on the glyph in Preview takes one to the relevant curs lookup - we want rlig).

(One could export an otlfd file and search but depending on classes etc that could be unwieldy - this should be doable from the GUI).

(Idea: Given a glyph in the resultant glyph string below Preview, come up with a reasonable way to select and see what lookups it participates in. Etc.)

Thank you in advance.
Input: Arabic
/Lam/Hah/Meem/Dal

Step 1:
Feature: init (Initial Forms), lookup: MultipleSubstitution5 (MultipleSubstitution) Subtable 1, index: 0, action Lam -> LamIni

/LamIni/Hah/Meem/Dal

Step 2:
Feature: medi (Medial Forms), lookup: MultipleSubstitution7 (MultipleSubstitution) Subtable 1, index: 1, action Hah -> HahMed
Feature: medi (Medial Forms), lookup: MultipleSubstitution7 (MultipleSubstitution) Subtable 1, index: 2, action Meem -> MeemMed

/LamIni/HahMed/MeemMed/Dal

Step 3:
Feature: fina (Terminal Forms), lookup: MultipleSubstitution8 (MultipleSubstitution) Subtable 1, index: 3, action Dal -> DalFin

/LamIni/HahMed/MeemMed/DalFin

Step 4:
Feature: rlig (Required Ligatures), lookup: ChainingContext8 (ChainingContext) Subtable 1, index: 0, action rule
Feature: rlig (Required Ligatures), lookup: SingleSubstitution38 (SingleSubstitution) Subtable 1, index: 0, action LamIni -> LamIni.outD2H
Feature: rlig (Required Ligatures), lookup: ChainingContext8 (ChainingContext) Subtable 1, index: 1, action rule
Feature: rlig (Required Ligatures), lookup: SingleSubstitution19 (SingleSubstitution) Subtable 1, index: 1, action HahMed -> HahMed.inD2
Feature: rlig (Required Ligatures), lookup: ChainingContext8 (ChainingContext) Subtable 1, index: 1, action rule
Feature: rlig (Required Ligatures), lookup: SingleSubstitution39 (SingleSubstitution) Subtable 1, index: 1, action HahMed.inD2 -> HahMed.inD2outD2MM
Feature: rlig (Required Ligatures), lookup: ChainingContext8 (ChainingContext) Subtable 1, index: 2, action rule
Feature: rlig (Required Ligatures), lookup: SingleSubstitution19 (SingleSubstitution) Subtable 1, index: 2, action MeemMed -> MeemMed.inD2
Feature: rlig (Required Ligatures), lookup: ChainingContext8 (ChainingContext) Subtable 1, index: 2, action rule
Feature: rlig (Required Ligatures), lookup: SingleSubstitution31 (SingleSubstitution) Subtable 1, index: 2, action MeemMed.inD2 -> MeemMed.inD2outT1

/LamIni.outD2H/HahMed.inD2outD2MM/MeemMed.inD2outT1/DalFin
Erwin Denissen
High-Logic
Proven Font Technology
Erwin Denissen
Moderator
Moderator
Posts: 11108
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Debugging Tools?

Post by Erwin Denissen »

Hermes14 wrote: Sat Sep 09, 2017 2:39 pm Another example, same font:

sample: ہو
features: curs fina init rlig

Toggle rlig

With rlig on, click on rightmost character in Preview: This takes us to SingleSubstitution33.

Go to Features - RequiredLigatures (rlig) in the left pane.

Challenge: Find a the contextual chain that calls SingleSubstitution33 - I could not find it.
Input: Arabic
/HehUrdu/Waw

Step 1:
Feature: init (Initial Forms), lookup: MultipleSubstitution5 (MultipleSubstitution) Subtable 1, index: 0, action HehUrdu -> HehIni HehCommaNS

/HehIni/HehCommaNS/Waw

Step 2:
Feature: fina (Terminal Forms), lookup: MultipleSubstitution8 (MultipleSubstitution) Subtable 1, index: 2, action Waw -> WawFin

/HehIni/HehCommaNS/WawFin

Step 3:
Feature: rlig (Required Ligatures), lookup: ChainingContext7 (ChainingContext) Subtable 1, index: 0, action rule
Feature: rlig (Required Ligatures), lookup: SingleSubstitution33 (SingleSubstitution) Subtable 1, index: 0, action HehIni -> HehIni.outT3
Feature: rlig (Required Ligatures), lookup: ChainingContext7 (ChainingContext) Subtable 1, index: 0, action rule

/HehIni.outT3/HehCommaNS/WawFin

Step 4:
Feature: rlig (Required Ligatures), lookup: ChainingContext8 (ChainingContext) Subtable 1, index: 2, action rule
Feature: rlig (Required Ligatures), lookup: SingleSubstitution58 (SingleSubstitution) Subtable 1, index: 2, action WawFin -> WawFin.cut

/HehIni.outT3/HehCommaNS/WawFin.cut

Step 5:
Feature: curs (Cursive Positioning), lookup: CursiveAttachment1 (CursiveAttachment) Subtable 1, index: 2 - 0, action cursive HehIni.outT3 WawFin.cut (0, 0)
SetLayoutPosCurs (0) HehIni.outT3 (Simple) :xy (0, 0) wh (0, 0)
SetLayoutPosCurs (2) WawFin.cut (Simple) :xy (0, -421) wh (0, 0)

FixCursiveRTL:
Found glyphs 2 (WawFin.cut) and 0 (HehIni.outT3) diff -421
LayoutPlacement glyph 0 (HehIni.outT3) Y 421
LayoutPlacement glyph 1 (HehCommaNS) Y 421
LayoutPlacement glyph 2 (WawFin.cut) Y 0

/HehIni.outT3/HehCommaNS/WawFin.cut
Erwin Denissen
High-Logic
Proven Font Technology
Erwin Denissen
Moderator
Moderator
Posts: 11108
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Debugging Tools?

Post by Erwin Denissen »

Right now this output is not available in the public release. I've only recently added in the debug version while improving the Preview feature.

I'm considering adding it as I know it is very useful, but I'm not sure if this is the right way and if it should only be available in the Professional edition or if we should introduce a Super edition for $499 :D
Erwin Denissen
High-Logic
Proven Font Technology
Erwin Denissen
Moderator
Moderator
Posts: 11108
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Debugging Tools?

Post by Erwin Denissen »

Erwin Denissen wrote: Sat Sep 09, 2017 3:23 pm Feature: rlig (Required Ligatures), lookup: ChainingContext8 (ChainingContext) Subtable 1, index: 1, action rule
Feature: rlig (Required Ligatures), lookup: SingleSubstitution19 (SingleSubstitution) Subtable 1, index: 1, action HahMed -> HahMed.inD2
Feature: rlig (Required Ligatures), lookup: ChainingContext8 (ChainingContext) Subtable 1, index: 1, action rule
Feature: rlig (Required Ligatures), lookup: SingleSubstitution39 (SingleSubstitution) Subtable 1, index: 1, action HahMed.inD2 -> HahMed.inD2outD2MM
Applying a lookup on the same index twice looks like a bug to me. Can you confirm this?
Erwin Denissen
High-Logic
Proven Font Technology
Hermes14
Posts: 22
Joined: Mon Jul 10, 2017 9:22 pm

Re: Debugging Tools?

Post by Hermes14 »

Erwin Denissen wrote: Sat Sep 09, 2017 3:28 pm Right now this output is not available in the public release. I've only recently added in the debug version while improving the Preview feature.

I'm considering adding it as I know it is very useful, but I'm not sure if this is the right way and if it should only be available in the Professional edition or if we should introduce a Super edition for $499 :D
Many thanks. Will study your replies closely and try to reply over this weekend. As for the Super Edition; will be happy to invest in that to complete and have the best OpenType Designer ever :wink:
Hermes14
Posts: 22
Joined: Mon Jul 10, 2017 9:22 pm

Re: Debugging Tools?

Post by Hermes14 »

Erwin Denissen wrote: Sat Sep 09, 2017 3:25 pm
Hermes14 wrote: Sat Sep 09, 2017 2:39 pm sample: ہو
features: curs fina init rlig

Toggle rlig

With rlig on, click on rightmost character in Preview: This takes us to SingleSubstitution33.

Go to Features - RequiredLigatures (rlig) in the left pane.

Challenge: Find a the contextual chain that calls SingleSubstitution33 - I could not find it.
Step 3:
Feature: rlig (Required Ligatures), lookup: ChainingContext7 (ChainingContext) Subtable 1, index: 0, action rule
Feature: rlig (Required Ligatures), lookup: SingleSubstitution33 (SingleSubstitution) Subtable 1, index: 0, action HehIni -> HehIni.outT3
Feature: rlig (Required Ligatures), lookup: ChainingContext7 (ChainingContext) Subtable 1, index: 0, action rule

/HehIni.outT3/HehCommaNS/WawFin
In the left pane, under the branch Scripts - Arabic (arab) - Default - RequiredLigatures (rlig):

ChainingContext7 is mentioned but not SingleSubstitution33. Nor does ChainingContext7 include SingleSubstitution33 as a substitution table.

So where is SingleSubstitution33 supposed to appear in the left pane? Is this a GUI bug?
Erwin Denissen
Moderator
Moderator
Posts: 11108
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Debugging Tools?

Post by Erwin Denissen »

ChainingContext7 contains 230 rules. Rule 5 is the first which has SingleSubstitution33, but there are many more.

You can easily search them if you click the "Code Editor" button on the top tool bar.
Erwin Denissen
High-Logic
Proven Font Technology
Hermes14
Posts: 22
Joined: Mon Jul 10, 2017 9:22 pm

Re: Debugging Tools?

Post by Hermes14 »

Erwin Denissen wrote: Sun Sep 10, 2017 7:42 am ChainingContext7 contains 230 rules. Rule 5 is the first which has SingleSubstitution33, but there are many more.

You can easily search them if you click the "Code Editor" button on the top tool bar.
Wow, was going around in circles for hours trying to figure this out.

So there is either a bug in the gui, or it is misleading, or both ;-) : SingleSubstitution32 is the only table that appears in the right column under Substitution Tables and is also the first entry in the Code Editor representation. The gui gives the impression that SingleSubstitution32 is the only rule table contained within ChainingContext7. One of the things tried was to go through every ChainingContext<n> under rlig and to examine its substitution tables. Via the gui, could not find anything, which was perplexing.

So the gui appears to need some work here :-)

It never came to mind that the gui was not correctly representing the lookups. So what was needed was to compare the gui representation with the otlfd export: That means going through each lookup manually searching for SingleSubstitution33. SingleSubstitution33 is mentioned 62 times in the otlfd file: There has got to be a better way!

Also, do not see any reference to, e.g., Rule 5 in the Code Editor. Where are these rules indexed?

Many thanks for your patience with these persistent inquiries during this struggle to grasp the power and limitations of OTD, and to formulate helpful suggestions.
Hermes14
Posts: 22
Joined: Mon Jul 10, 2017 9:22 pm

Re: Debugging Tools?

Post by Hermes14 »

Erwin Denissen wrote: Sat Sep 09, 2017 4:13 pm
Erwin Denissen wrote: Sat Sep 09, 2017 3:23 pm Feature: rlig (Required Ligatures), lookup: ChainingContext8 (ChainingContext) Subtable 1, index: 1, action rule
Feature: rlig (Required Ligatures), lookup: SingleSubstitution19 (SingleSubstitution) Subtable 1, index: 1, action HahMed -> HahMed.inD2
Feature: rlig (Required Ligatures), lookup: ChainingContext8 (ChainingContext) Subtable 1, index: 1, action rule
Feature: rlig (Required Ligatures), lookup: SingleSubstitution39 (SingleSubstitution) Subtable 1, index: 1, action HahMed.inD2 -> HahMed.inD2outD2MM
Applying a lookup on the same index twice looks like a bug to me. Can you confirm this?
See what you mean, yet it works.. Could you point to a place in the spec or elsewhere that proscribes applying a lookup on the same index twice? Instructive example, don't think one could do this in VOLT.. think that one would have to split this operation into two separate contextual lookups..

This is what ConTeXt gives (uses pre-release code, still testing):

feature 'rlig', type 'gsub_contextchain', chain lookup 's_s_27', replacing single
U+F0139 (LamIni) by U+F014D (LamIni.outD2H)

feature 'rlig', type 'gsub_contextchain', chain lookup 's_s_27', replacing single
U+F01E8 (HahMed) by U+F02C9 (HahMed.inD2)
feature 'rlig', type 'gsub_contextchain', chain lookup 's_s_27', replacing single
U+F02C9 (HahMed.inD2) by U+F0246 (HahMed.inD2outD2MM)

feature 'rlig', type 'gsub_contextchain', chain lookup 's_s_27', replacing single
U+F0136 (MeemMed) by U+F02CB (MeemMed.inD2)
feature 'rlig', type 'gsub_contextchain', chain lookup 's_s_27', replacing single
U+F02CB (MeemMed.inD2) by U+F02D2 (MeemMed.inD2outT1)
Post Reply