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

Font support with freetype #177

Closed
wants to merge 13 commits into from
Closed

Font support with freetype #177

wants to merge 13 commits into from

Conversation

GDQR
Copy link
Contributor

@GDQR GDQR commented Jan 23, 2024

-Font Render
-Load with Freetype
-Set the font size.
-font color support
-Set correct color.
-Support for setting the maximum font texture cache size. -Texture loaded with 32bit
-New tutorial

Need #174 and #175 to work.

use this font for the example https://fonts.google.com/specimen/Roboto, it is licensed Apache version 2.0

helloworldtyra.mp4

-Font Render
-Load with Freetype
-Support for setting the maximum font texture cache size.
-Texture loaded with 32bit
-New tutorial
@GDQR
Copy link
Contributor Author

GDQR commented Jan 23, 2024

I fix it later.

@h4570
Copy link
Owner

h4570 commented Jan 23, 2024

Cool!

Thank you for the contributing.
I will try to find some time this week and check all of the PRs

@GDQR
Copy link
Contributor Author

GDQR commented Jan 23, 2024

No problem, meanwhile I will be solving these errors.

@Wolf3s
Copy link
Contributor

Wolf3s commented Jan 23, 2024

Tutorial's 10 class Font is conflicting with font.hpp. The error can be found here: https://github.com/h4570/tyra/blob/master/tutorials/10-sprite-sheet/inc/font_sprite.hpp

@GDQR
Copy link
Contributor Author

GDQR commented Jan 23, 2024

yeah, I'm going to delete the font of tutorial 10 and change it to the new one I made.
this is how it looks now.
I will make some corrections to make it look better
tutorial10

@Wolf3s
Copy link
Contributor

Wolf3s commented Jan 23, 2024

yeah, I'm going to delete the font of tutorial 10 and change it to the new one I made. this is how it looks now. I will make some corrections to make it look better tutorial10

Nice stuff.

@GDQR
Copy link
Contributor Author

GDQR commented Jan 23, 2024

thanks

@GDQR
Copy link
Contributor Author

GDQR commented Jan 23, 2024

ok, idk how to fix these 2 minor issues, I need help ;-; , also tutorial 10 now also needs the Roboto-black font.

@h4570
Copy link
Owner

h4570 commented Feb 11, 2024

It looks really promising! I will do review in a sec...

Copy link
Owner

@h4570 h4570 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to fetch latest master code and change number of the tutorial to 12.

@@ -42,6 +42,7 @@ void Engine::initAll(const bool& loadUsbDriver) {
banner.show(&renderer);
audio.init();
pad.init();
fontInit(&renderer);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New font class should be more object oriented (like font.init(...), etc.).
Please refactor it to make it look like the neighboring classes (pad, audio, etc.)
Please avoid to use extern in following hpp file - probably is not needed here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about doing that but I also thought that an exception could be made 😅, since it was something that is used a lot and it would be easier to access the function directly. well now I change it.

extern void unloadFont(Font* font);
extern void drawText(Font* font, std::string text, float x, float y,
int fontSize, Color color);
// extern void drawText(std::string text, float x, float y, int fontSize,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to remove all commented/temporary code

@h4570
Copy link
Owner

h4570 commented Feb 11, 2024

ok, idk how to fix these 2 minor issues, I need help ;-; , also tutorial 10 now also needs the Roboto-black font.

What minor issues did you encounter? Maybe I can help with smth.

@GDQR
Copy link
Contributor Author

GDQR commented Feb 11, 2024

What minor issues did you encounter? Maybe I can help with smth.

Don't worry, they were some problems with the codacy static code analysis, I already solved them. but thanks anyway.

@h4570 h4570 added the enhancement New feature or request label Feb 11, 2024
GDQR and others added 3 commits February 12, 2024 01:11
-font color support
-individual character loading support
-option to disable texture limits
@GDQR
Copy link
Contributor Author

GDQR commented Feb 18, 2024

I have to fix something else but this is how it looks.
Fonts used:
https://fonts.google.com/specimen/Roboto (bold)
Segoe UI Emoji
fontTyra

@GDQR
Copy link
Contributor Author

GDQR commented Feb 18, 2024

I've finished now.

@Wellinator
Copy link
Contributor

Awesome job!!!

@GDQR GDQR requested a review from h4570 February 21, 2024 21:54
@matt-comm-link
Copy link

Is this still in the pipeline?

@GDQR
Copy link
Contributor Author

GDQR commented May 26, 2024

not for now, it currently works, but it would be nice to update/add some things

@matt-comm-link
Copy link

Would you say it's stable enough to migrate a project to in the meantime or would it be best left alone until it's ready to be merged?

@GDQR
Copy link
Contributor Author

GDQR commented Jun 3, 2024

yeah it's stable, I was using it for my own project and I didn't have any problems.

@Wellinator
Copy link
Contributor

@GDQR how's it going?!
Is this feature finished?
I was planning to add font support for my game.

@GDQR
Copy link
Contributor Author

GDQR commented Aug 12, 2024

I was busy with other things, I didn't advance on this, there are things that I think can be improved, like the spacing between letters but currently it works, later I will make another PR that has fewer commits, i clarify that i don't know when I will do it.

@GDQR GDQR closed this Sep 1, 2024
@Wolf3s
Copy link
Contributor

Wolf3s commented Sep 1, 2024

?

@Wolf3s
Copy link
Contributor

Wolf3s commented Sep 1, 2024

@GDQR

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

Successfully merging this pull request may close these issues.

5 participants