Skip to content

Commit

Permalink
Fix dot removal on various derived glyphs (#513).
Browse files Browse the repository at this point in the history
  • Loading branch information
be5invis committed Apr 27, 2020
1 parent b4e0794 commit 20a9e9e
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 33 deletions.
3 changes: 2 additions & 1 deletion changes/3.0.0-x-next.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* Fix missing mapping regression of U+1D0D (#510).
* Fix missing mapping regression of U+1D0D (#510).
* Fix dot removal on various derived glyphs (#513).
1 change: 1 addition & 0 deletions gen/build-glyphs.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export all : define [buildGlyphs para recursive recursiveCodes] : begin
set g.shortName t.shortName
set g.cmpPriority t.cmpPriority
set g.flatten t.flatten
set g.related t.related
if name : set dependencyProfile.(name) : getDependencyProfile g
if (g && unicode) : begin
g.assign-unicode unicode
Expand Down
96 changes: 65 additions & 31 deletions glyphs/autobuild-transformed.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,79 @@ glyph-block Autobuild-Transformed : begin
set name (name + j)
return name

define [createSuperscripts records] : begin
define TrackingRelations { 'dotless' }
define [extendRelatedGlyphs records relations suffix] : begin
local relatedRecords {}
local relMap {.}
local targetNameMap {.}
foreach [rel : items-of relations] : set relMap.(rel) {.}
foreach [record : items-of records] : begin
local srcName record.1
set targetNameMap.(srcName) : suggestName (srcName + '+' + suffix)
local g : query-glyph srcName
if (g && g.related) : foreach [rel : items-of relations] : if (g.related.(rel)) : begin
local relSourceName g.related.(rel)
set targetNameMap.(relSourceName) : suggestName (relSourceName + '+' + suffix)
local relatedRecord : record.slice 0
set relatedRecord.0 null
set relatedRecord.1 relSourceName
relatedRecords.push relatedRecord
set relMap.(rel).(srcName) relSourceName
return {[records.concat relatedRecords] relMap targetNameMap}

define [apply-relations g gn relMap targetNameMap] : begin
foreach [{rel rm} : pairs-of relMap] : begin
local relSrc rm.(gn)
if relSrc : begin
if [not g.related] : set g.related {.}
set g.related.(rel) targetNameMap.(relSrc)

define [createSuperscripts _records] : begin
local {records relMap targetNameMap} : extendRelatedGlyphs _records TrackingRelations 'sup'
local pendingGlyphs : records.map : [record] => record.1
local miniatureFont : Miniature
glyphs -- pendingGlyphs
crowd -- 4
scale -- 0.7
mono -- true
sbscale -- 1
foreach {unicode glyphid pri} [items-of records] : create-glyph [suggestName : glyphid + '+sup'] : glyph-construction
if unicode : assign-unicode unicode
local middle : miniatureFont.(glyphid).advanceWidth / 2
include miniatureFont.(glyphid) AS_BASE ALSO_METRICS
apply-transform [Upright] true
apply-transform [Translate (-middle) (-CAP)] true
apply-transform [Scale 0.7] true
apply-transform [Translate middle (CAP + ACCENT / 2)] true
apply-transform [Italify] true
if pri : set currentGlyph.cmpPriority pri

define [createSubscripts records] : begin
foreach {unicode glyphid pri} [items-of records]
create-glyph (targetNameMap.(glyphid)) : glyph-construction
if unicode : assign-unicode unicode
local middle : miniatureFont.(glyphid).advanceWidth / 2
include miniatureFont.(glyphid) AS_BASE ALSO_METRICS
apply-transform [Upright] true
apply-transform [Translate (-middle) (-CAP)] true
apply-transform [Scale 0.7] true
apply-transform [Translate middle (CAP + ACCENT / 2)] true
apply-transform [Italify] true
if pri : set currentGlyph.cmpPriority pri
apply-relations currentGlyph glyphid relMap targetNameMap

define [createSubscripts _records] : begin
local {records relMap targetNameMap} : extendRelatedGlyphs _records TrackingRelations 'sub'
local pendingGlyphs : records.map : [record] => record.1
local miniatureFont : Miniature
glyphs -- pendingGlyphs
crowd -- 4
scale -- 0.7
mono -- true
sbscale -- 1
foreach {unicode glyphid pri} [items-of records] : create-glyph [suggestName : glyphid + '+sub'] : glyph-construction
if unicode : assign-unicode unicode
local middle : miniatureFont.(glyphid).advanceWidth / 2
include miniatureFont.(glyphid) AS_BASE ALSO_METRICS
apply-transform [Upright] true
apply-transform [Translate (-middle) 0] true
apply-transform [Scale 0.7] true
apply-transform [Translate middle (DESCENDER / 2)] true
apply-transform [Italify] true
if pri : set currentGlyph.cmpPriority pri

define [createSMCPs records] : begin
foreach {unicode glyphid pri} [items-of records]
create-glyph (targetNameMap.(glyphid)) : glyph-construction
if unicode : assign-unicode unicode
local middle : miniatureFont.(glyphid).advanceWidth / 2
include miniatureFont.(glyphid) AS_BASE ALSO_METRICS
apply-transform [Upright] true
apply-transform [Translate (-middle) 0] true
apply-transform [Scale 0.7] true
apply-transform [Translate middle (DESCENDER / 2)] true
apply-transform [Italify] true
if pri : set currentGlyph.cmpPriority pri
apply-relations currentGlyph glyphid relMap targetNameMap

define [createSMCPs _records] : begin
local {records relMap targetNameMap} : extendRelatedGlyphs _records TrackingRelations 'smcp'
local pendingGlyphs : records.map : [record] => record.1
local forkedParams : Object.create para
set forkedParams.cap0 para.cap
Expand All @@ -67,11 +101,12 @@ glyph-block Autobuild-Transformed : begin
set forkedParams.diversityI 1
set forkedParams.diversityII 1
local sf : Fork pendingGlyphs forkedParams
foreach {unicode glyphid tfm} [items-of records] : create-glyph [suggestName : 'smcp' + glyphid] : glyph-construction
if unicode : assign-unicode unicode
include sf.(glyphid) AS_BASE
set-width sf.(glyphid).advanceWidth
if tfm : include tfm
foreach {unicode glyphid} [items-of records]
create-glyph targetNameMap.(glyphid) : glyph-construction
if unicode : assign-unicode unicode
include sf.(glyphid) AS_BASE
set-width sf.(glyphid).advanceWidth
apply-relations currentGlyph glyphid relMap targetNameMap

define [createMedievalCombs records] : begin
local pendingGlyphs : records.map : [record] => record.1
Expand Down Expand Up @@ -299,7 +334,6 @@ glyph-block Autobuild-Transformed : begin
list 0x1D15 'OU'
list 0x1D18 'P'
list 0x1D19 'cyrYa'
list 0x1D1A 'R' [FlipAround MIDDLE (XH / 2)]
list 0x1D1B 'T'
list 0x1D20 'V'
list 0x1D21 'W'
Expand Down
13 changes: 12 additions & 1 deletion glyphs/letters-unified-basic.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ glyph-block LetterUnified-Basic : begin
CreateDottedComposition 'dotlessj' 'grkj' 0x3F3
CreateDottedComposition 'dotlessj' 'cyrje' 0x458

sketch # jcurlytail
sketch # dotlessjCurlyTail
include MarkSet.p
set-anchor 'above' BASE (MIDDLE + JBALANCE) XH
local fine : adviceBlackness 3.5
Expand All @@ -351,7 +351,13 @@ glyph-block LetterUnified-Basic : begin
flat m1 XH [heading DOWNWARD]
curl m1 (DESCENDER + fine + rinner * 2)
CurlyTail fine rinner m1 DESCENDER (m1 - LONGJUT) x2 y2
save 'dotlessjCurlyTail'

sketch # jcurlytail
include [refer-glyph 'dotlessjCurlyTail'] AS_BASE ALSO_METRICS
include : refer-glyph "dotAbove"
if [not currentGlyph.related] : set currentGlyph.related {.}
set currentGlyph.related.dotless 'dotlessjCurlyTail'
save 'jcurlytail' 0x29D

### L
Expand Down Expand Up @@ -2420,6 +2426,11 @@ glyph-block LetterUnified-Basic : begin
include [refer-glyph src] AS_BASE ALSO_METRICS
include : HBar [mix 0 SB 0.3] (SB - O) ((CAP - STROKE) * [RBarPos SLAB])

WithDerivatives 'smcpR' 'turnSmcpR' : lambda [src sel] : glyph-construction
if [not sel] : assign-unicode 0x1D1A
include [refer-glyph src] AS_BASE ALSO_METRICS
include : FlipAround MIDDLE (XH / 2)

sketch # Yr
include MarkSet.if
local top : CAP * 0.85
Expand Down

0 comments on commit 20a9e9e

Please sign in to comment.