package harfbuzz
import (
ot "github.com/go-text/typesetting/font/opentype"
"github.com/go-text/typesetting/font/opentype/tables"
ucd "github.com/go-text/typesetting/internal/unicodedata"
)
var _ otComplexShaper = complexShaperHebrew {}
type complexShaperHebrew struct {
complexShaperNil
}
var sDageshForms = [0x05EA - 0x05D0 + 1 ]rune {
0xFB30 ,
0xFB31 ,
0xFB32 ,
0xFB33 ,
0xFB34 ,
0xFB35 ,
0xFB36 ,
0x0000 ,
0xFB38 ,
0xFB39 ,
0xFB3A ,
0xFB3B ,
0xFB3C ,
0x0000 ,
0xFB3E ,
0x0000 ,
0xFB40 ,
0xFB41 ,
0x0000 ,
0xFB43 ,
0xFB44 ,
0x0000 ,
0xFB46 ,
0xFB47 ,
0xFB48 ,
0xFB49 ,
0xFB4A ,
}
func (complexShaperHebrew ) compose (c *otNormalizeContext , a , b rune ) (rune , bool ) {
ab , found := ucd .Compose (a , b )
if !found && !c .plan .hasGposMark {
switch b {
case 0x05B4 :
if a == 0x05D9 {
return 0xFB1D , true
}
case 0x05B7 :
if a == 0x05F2 {
return 0xFB1F , true
} else if a == 0x05D0 {
return 0xFB2E , true
}
case 0x05B8 :
if a == 0x05D0 {
return 0xFB2F , true
}
case 0x05B9 :
if a == 0x05D5 {
return 0xFB4B , true
}
case 0x05BC :
if a >= 0x05D0 && a <= 0x05EA {
ab = sDageshForms [a -0x05D0 ]
return ab , ab != 0
} else if a == 0xFB2A {
return 0xFB2C , true
} else if a == 0xFB2B {
return 0xFB2D , true
}
case 0x05BF :
switch a {
case 0x05D1 :
return 0xFB4C , true
case 0x05DB :
return 0xFB4D , true
case 0x05E4 :
return 0xFB4E , true
}
case 0x05C1 :
if a == 0x05E9 {
return 0xFB2A , true
} else if a == 0xFB49 {
return 0xFB2C , true
}
case 0x05C2 :
if a == 0x05E9 {
return 0xFB2B , true
} else if a == 0xFB49 {
return 0xFB2D , true
}
}
}
return ab , found
}
func (complexShaperHebrew ) marksBehavior () (zeroWidthMarks , bool ) {
return zeroWidthMarksByGdefLate , true
}
func (complexShaperHebrew ) normalizationPreference () normalizationMode {
return nmDefault
}
func (complexShaperHebrew ) gposTag () tables .Tag {
return ot .NewTag ('h' , 'e' , 'b' , 'r' )
}
func (complexShaperHebrew ) reorderMarks (_ *otShapePlan , buffer *Buffer , start , end int ) {
info := buffer .Info
for i := start + 2 ; i < end ; i ++ {
c0 := info [i -2 ].getModifiedCombiningClass ()
c1 := info [i -1 ].getModifiedCombiningClass ()
c2 := info [i -0 ].getModifiedCombiningClass ()
if (c0 == mcc17 || c0 == mcc18 ) &&
(c1 == mcc10 || c1 == mcc14 ) &&
(c2 == mcc22 || c2 == combiningClassBelow ) {
buffer .mergeClusters (i -1 , i +1 )
info [i -1 ], info [i ] = info [i ], info [i -1 ]
break
}
}
}
The pages are generated with Golds v0.8.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .