-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Glyph atlas preparations #18
Conversation
This reverts commit b81b946.
@@ -37,7 +47,8 @@ let run = () => { | |||
glfwMakeContextCurrent(w); | |||
glViewport(0, 0, 800, 600); | |||
|
|||
let%lwt font = Fontkit.load("Roboto-Regular.ttf", 24); | |||
let%lwt font = | |||
Fontkit.load(getExecutingDirectory() ++ "Roboto-Regular.ttf", 24); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So nice to be able to use esy x
for this too, nice!
FT_Bitmap bitmap = face->glyph->bitmap; | ||
int bitmapDataLength = bitmap.rows * abs(bitmap.pitch); | ||
bitmapBigarray = caml_ba_alloc_dims(CAML_BA_UINT8 | CAML_BA_C_LAYOUT, 2, NULL, bitmap.rows, abs(bitmap.pitch)); | ||
memcpy(Caml_ba_data_val(bitmapBigarray), (const char *)bitmap.buffer, bitmapDataLength); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent! That's great that we can copy directly into the Bigarray buffer vs allocated an extra one. Nice find 👍
@@ -1,18 +0,0 @@ | |||
|
|||
extern "C" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah this was duplicated between the projects - nice to see it go away!
* API: Add 'fk_get_metrics' API (#20) Add 'fk_get_metrics' API * 2.1.0 * Upgrade reason-glfw -> 3.2.1015 (#21) * Use hb_blob_create_from_file for mmap file reading (#19) Not tested locally however. * 2.2.0 * Add /opt/local/lib to link path (#22) * 2.2.1 * Update fontkit.cpp * Bring back iSize * Debugging * Get working on Windows * Add bitmap back
Thanks for your work here, @manuhornung ! |
This PR is required for revery-ui/revery#53
TODO: Fixate minimum
reason-glfw
version once we know it, i.e. after https://github.com/bryphe/reason-glfw/pull/87 has been mergedBigarray.Array2
s to allow access to the raw pixels