set font atlas to set width for ascii only
This commit is contained in:
parent
c0d9de9c4e
commit
482c0db8b2
9
fonts.d
9
fonts.d
@ -28,7 +28,7 @@ struct FontAtlas
|
|||||||
f32 descender;
|
f32 descender;
|
||||||
f32 underline_y;
|
f32 underline_y;
|
||||||
f32 underline_thickness;
|
f32 underline_thickness;
|
||||||
Glyph[] glyphs;
|
Glyph[128] glyphs;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Glyph
|
struct Glyph
|
||||||
@ -137,8 +137,6 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
|
|||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
atlas.atlas.glyphs = AllocArray!(Glyph)(arena, count);
|
|
||||||
|
|
||||||
max_w = 0;
|
max_w = 0;
|
||||||
max_h = 0;
|
max_h = 0;
|
||||||
current_h = 0;
|
current_h = 0;
|
||||||
@ -182,7 +180,7 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Glyph* g = atlas.atlas.glyphs.ptr + count;
|
Glyph* g = atlas.atlas.glyphs.ptr + char_count;
|
||||||
|
|
||||||
g.ch = cast(dchar)char_code;
|
g.ch = cast(dchar)char_code;
|
||||||
g.advance = cast(f32)(glyph.advance.x >> 6);
|
g.advance = cast(f32)(glyph.advance.x >> 6);
|
||||||
@ -201,11 +199,8 @@ CreateAtlas(Arena* arena, FontFace font, f32 size, u32 dimension)
|
|||||||
|
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return atlas;
|
return atlas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user