mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-20 23:47:16 -05:00
commit
318e4ac7e2
@ -6,7 +6,7 @@ func Create(frame, width, height int) *FontGlyph {
|
||||
// nolint:gomnd // thes bytes are constant
|
||||
// comes from https://d2mods.info/forum/viewtopic.php?t=42044
|
||||
result := &FontGlyph{
|
||||
unknown1: []byte{0, 0},
|
||||
unknown1: []byte{0},
|
||||
unknown2: []byte{1, 0, 0},
|
||||
unknown3: []byte{0, 0, 0, 0, 0},
|
||||
frame: frame,
|
||||
|
@ -16,6 +16,8 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
numHeaderBytes = 12
|
||||
bytesPerGlyph = 14
|
||||
signatureBytesCount = 5
|
||||
unknownHeaderBytesCount = 7
|
||||
unknown1BytesCount = 1
|
||||
@ -147,13 +149,13 @@ func (f *Font) RenderText(text string, target d2interface.Surface) error {
|
||||
func (f *Font) initGlyphs(sr *d2datautils.StreamReader) error {
|
||||
glyphs := make(map[rune]*d2fontglyph.FontGlyph)
|
||||
|
||||
for i := 12; i < len(f.table); i += 14 {
|
||||
for i := numHeaderBytes; i < len(f.table); i += bytesPerGlyph {
|
||||
code, err := sr.ReadUInt16()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// two bytes of 0
|
||||
// byte of 0
|
||||
sr.SkipBytes(unknown1BytesCount)
|
||||
|
||||
width, err := sr.ReadByte()
|
||||
|
Loading…
x
Reference in New Issue
Block a user