Skip to content
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

[rtext] add ExportFontAsCodeEx() #4213

Closed
wants to merge 1 commit into from
Closed

Conversation

rnpnr
Copy link
Contributor

@rnpnr rnpnr commented Aug 5, 2024

Hi All,

This PR introduces a function to export font as code without ever opening a window. This allows me to include the required font file with my project's source code and export it as an automatically generated header from a build script on a system without a GPU present.

Any comments/review is appreciated!

Commit message follows:

ExportFontAsCode() loads image data from a font that is already uploaded to the GPU; this means that it requires a full graphics context/window. ExportFontAsCodeEx() loads the relevant font data into an atlas itself without ever creating a texture. This makes it possible to export font data as part of a build step when compiling a project when there is no GPU present (e.g. github CI).

One minor change is that ExportFontAsCode() no longer converts the name to PascalCase. Its up to the user to pass the name in in that format if they want it.

ExportFontAsCode() loads image data from a font that is already
uploaded to the GPU; this means that it requires a full graphics
context/window. ExportFontAsCodeEx() loads the relevant font data
into an atlas itself without ever creating a texture. This makes
it possible to export font data as part of a build step when
compiling a project when there is no GPU present (e.g. github CI).

One minor change is that ExportFontAsCode() no longer converts the
name to PascalCase. Its up to the user to pass the name in in that
format if they want it.
@raysan5
Copy link
Owner

raysan5 commented Aug 6, 2024

@rnpnr I'm afraid this function is intended for a very specific use case but it breaks the consistency with the other Export*() and Export*AsCode() functions; It also requires a considerable amount of input parameters. I also adds static functions and functions calling functions, something that I try to minimize in raylib.

I'm afraid I'm not merging this PR.

@raysan5 raysan5 closed this Aug 6, 2024
@rnpnr
Copy link
Contributor Author

rnpnr commented Aug 6, 2024

Hi @raysan5, I understand. I'm happy to work on something you would find more acceptable. I just want a way to export a font without opening a window/initializing a graphics context. Perhaps a way of loading a Font without uploading it to the GPU? IsFontReady() already accounts for the Font missing a valid texture id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants