Skip to content

Commit

Permalink
Change kerning behavior of hyphen.
Browse files Browse the repository at this point in the history
  • Loading branch information
sharoncorrell committed Jan 30, 2025
1 parent b0d09d1 commit 22509ab
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions source/graphite/nastaliq_positioning.gdh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


table(glyph)
cLowPunct = ( gComma gFullStop gSemicolon g_colonArab g_ellipsisArab );
cLowPunct = ( gComma gFullStop gSemicolon g_colonArab g_ellipsisArab g_hyphenArab );
cHighPunct = ( g_exclamArab gQuestionMark g_parenleftArab g_parenrightArab
g_bracketleftArab g_bracketrightArab g_braceleftArab g_bracerightArab
g_quoteleftArab g_quoterightArab g_quotedblleftArab g_quotedblrightArab g_quotedblArab g_quotesingleArab );
Expand Down Expand Up @@ -73,7 +73,7 @@ cIso { seqWidth = advance.x }; // start a new sequence
#if KERNLOWPUNCT
// low punctuation should be treated as part of the word sequence
cLowPunct { seqWidth += @P.advance.x + @P.seqWidth }
/ (cIso cFin)=P MARKS2N _=N;
/ (cIso cFin cDigitAny)=P MARKS2N _=N;
#endif

/***
Expand Down Expand Up @@ -167,6 +167,8 @@ endif;
//(cVisSpace cshowInv g_zeroWidthNoBreakSpaceShowInv_alt cShowInvBoxes cEmbedMarkers)
// { collision.flags = SET_ISSPACE(collision.flags) };



endpass; // 1 (8)

endtable; // positioning
Expand Down Expand Up @@ -610,7 +612,14 @@ endtable;

table(glyph) {AttributeOverride = 1}

cPostKernable = (cIso, cIni, cKernPunct) {
g_wordThessalonians {kernBbRightS.x = 0m};
g_wordThessalonik {kernBbRightS.x = 0m};
g_wordThessaloni {kernBbRightS.x = 0m};
g_wordThess {kernBbRightS.x = 0m};
g_wordTimothy {kernBbRightS.x = 0m};
g_wordAlmasih {kernBbRightS.x = 0m};

cPostKernable = (cIso, cIni, cKernPunct, g_wordThessalonik, g_wordThessaloni, g_wordThess, g_wordTimothy, g_wordAlmasih) {
dbgBbRight = bb.right; dbgRsb = rsb; dbgAdv = advancewidth;
kernRsb = advancewidth - ((kernBbRightS.x == 0) ? bb.right : kernBbRightS.x);
//// dbgNaturalRsb = advancewidth - bb.right;
Expand Down Expand Up @@ -1415,7 +1424,7 @@ csKafMed_medium g__kafTop_null
> csKafMed_baseT$K2 csKafMed_top_tall$K2
/ csKafIM_base g__kafMedTop_tall MARKS _=K2 _=T2;

cNuqtaLikeUpperNoKT csKafMed_medium g__kafTop_null
cNuqtaLikeUpperNoKT csKafMed_medium g__kafTop_null
> @N STAYBELOWKAF csKafMed_baseT$K csKafMed_top_tall$K
/ _=N cBaseTall MARKS _=K _=T;

Expand All @@ -1434,7 +1443,7 @@ cNuqtaLikeUpper csKafMed_medium g__kafTop_null
> @N STAYBELOWKAF csKafMed_baseT$K csKafMed_top_tall$K
/ _=N cDiacriticUpper? _=K _=T;

// Exception to rule below, because there is no 'taller' form for pre-meem:
// Exception to rule below, because there is no 'taller' form for pre-meem:
cDiacriticUpper gKafIniMm g__kafTop_null
> @D STAYBELOWKAF @K @T
/ (gAlef cAlefFin) _=D _=K {position.y < 1100m} _=T;
Expand Down Expand Up @@ -1517,7 +1526,7 @@ cTahIM csKafMed_medium g__kafTop_null
/ _=Ta cNuqtaLike? cDiacritic? c_narrow cNuqtaLike? cDiacritic? _=K _=T;

// Medium-short: nuqta + jeem + kaf...
cNuqtaLikeUpperNoKT csKafMed_medium g__kafTop_null
cNuqtaLikeUpperNoKT csKafMed_medium g__kafTop_null
> @N {shift.x = -300m; collision {max.x = 600m; max.y = 200m}} // move right, not up
csKafMed_baseT$K csKafMed_top_medshort$K
/ _=N cDiacritic? cJeemMed_stdwidth cNuqtaLike? cDiacritic? _=K _=T;
Expand All @@ -1537,6 +1546,11 @@ cNuqtaLikeUpperNoKT csKafMed_medium g__kafTop_null
> @N STAYBELOWKAF csKafMed_baseT$K csKafMed_top_tall$K
/ cJeemIM cNuqtaLike? cDiacritic? cMed _=N cDiacritic? _=K _=T;

// Situations where short kaf is needed due to height (except cases above where we know it's not appropriate)

// Notice that we never substitute a shorter kaf for gKafMedJm_lowentry, because it is used when we need extra
// vertical space.

// No change: never make shorter after a kaf/gaf.
cNuqtaLikeUpperNoKT? cKafMed g__kafTop_null
> @N @K @T
Expand All @@ -1552,11 +1566,6 @@ cNuqtaLikeUpperNoKT? csKafIM_medium g__kafTop_null
> @N STAYBELOWKAF @K @T
/ cKafTopAltHt _=N cDiacritic? ^ _=K _=T;

// Situations where short kaf is needed due to height (except cases above where we know it's not appropriate)

// Notice that we never substitute a shorter kaf for gKafMedJm_lowentry, because it is used when we need extra
// vertical space.

cNuqtaLikeUpperNoKT? csKafIM_medium g__kafTop_null
> @N STAYBELOWKAF csKafIM_base$K csKafIM_top_shorter$K
/ _=N cDiacritic? _=K {position.y > SHORTERKAF_HT && (shortForms == 1 || shortForms == 3)} _=T;
Expand Down

0 comments on commit 22509ab

Please sign in to comment.