mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Updated Freetype
This commit is contained in:
@@ -40,6 +40,7 @@ namespace GlitchyEngine.Renderer.Text
|
||||
}
|
||||
|
||||
internal FT_Face _face ~ FreeType.Done_Face(_face);
|
||||
internal hb_font_t* _harfBuzzFont ~ hb_font_destroy(_);
|
||||
|
||||
private Font _fallback ~ _?.ReleaseRef();
|
||||
|
||||
@@ -63,10 +64,6 @@ namespace GlitchyEngine.Renderer.Text
|
||||
|
||||
internal double _range = 4.0;
|
||||
|
||||
private hb_blob_t* blob ~ hb_blob_destroy(_);
|
||||
private hb_face_t* face ~ hb_face_destroy(_);
|
||||
private hb_font_t* font ~ hb_font_destroy(_);
|
||||
|
||||
/**
|
||||
* Gets or sets the fallback Font for this Font.
|
||||
* The Fallback font will be used to render Glyphs that are not defined in the current font.
|
||||
@@ -144,11 +141,8 @@ namespace GlitchyEngine.Renderer.Text
|
||||
|
||||
// HarfBuzz
|
||||
{
|
||||
blob = hb_blob_create_from_file(fontPath.CStr()); /* or hb_blob_create_from_file_or_fail() */
|
||||
face = hb_face_create(blob, 0);
|
||||
font = hb_font_create(face);
|
||||
|
||||
hb_font_set_scale(font, (.)fontSize * 64, (.)fontSize * 64);
|
||||
_harfBuzzFont = hb_ft_font_create_referenced(_face);
|
||||
hb_font_set_scale(_harfBuzzFont, (.)fontSize * 64, (.)fontSize * 64);
|
||||
}
|
||||
|
||||
//TestMSDF();
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace GlitchyEngine.Renderer.Text
|
||||
hb_buffer_set_language(buf, hb_language_from_string("en".CStr(), -1));
|
||||
|
||||
// 3. Get the face
|
||||
hb_font_t* hb_font = font.[Friend]font;
|
||||
hb_font_t* hb_font = font._harfBuzzFont;
|
||||
|
||||
// 4. Shape:
|
||||
hb_shape(hb_font, buf, null, 0);
|
||||
@@ -180,12 +180,14 @@ namespace GlitchyEngine.Renderer.Text
|
||||
Color glyphColor = glyphDesc.IsBitmap ? bitmapColor : fontColor;
|
||||
|
||||
texRect /= Vector4(atlasSize, atlasSize);
|
||||
|
||||
Renderer2D.DrawQuad(Vector3(viewportRect.X + viewportRect.Z / 2, viewportRect.Y + viewportRect.W / 2, 1), .(viewportRect.Z, viewportRect.W), 0, .Red);
|
||||
|
||||
// Show quads
|
||||
// Renderer2D.DrawQuad(Vector3(viewportRect.X + viewportRect.Z / 2, viewportRect.Y + viewportRect.W / 2, 1), .(viewportRect.Z, viewportRect.W), 0, .Red);
|
||||
|
||||
Renderer2D.DrawQuad(Vector2(viewportRect.X + viewportRect.Z / 2, viewportRect.Y + viewportRect.W / 2), .(viewportRect.Z, viewportRect.W), 0, atlas, glyphColor, texRect);
|
||||
|
||||
Renderer2D.DrawQuad(Vector3(penPosition, baseline, -1), .(1), 0, .Green);
|
||||
// Show pen positions
|
||||
// Renderer2D.DrawQuad(Vector3(penPosition, baseline, -1), .(1), 0, .Green);
|
||||
|
||||
penPosition += (x_advance / 64) * glyphFontScale;
|
||||
baseline += (y_advance / 64) * glyphFontScale;
|
||||
|
||||
Vendored
+1
-1
Submodule GlitchyEngine/vendor/freetype updated: f41e3fd511...e37574ca4e
Reference in New Issue
Block a user