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

Tidy up font code #330

Merged
merged 3 commits into from Apr 6, 2023
Merged

Tidy up font code #330

merged 3 commits into from Apr 6, 2023

Conversation

a740g
Copy link
Contributor

@a740g a740g commented Apr 4, 2023

This PR is an effort (the first of many) to reach the end goal in #188.

The following changes were made:

  • Consolidate required files into internal/c/parts/video/font/ and remove unnecessary files
  • Avoid including src.c from libqb.cpp and instead move font code to font.cpp that is compiled using a makefile
  • If font support is not needed the makefile will compile a stub instead
  • Update to FreeType 2.4.12 Amalgamation

In subsequent font PRs, I'll try to move more font functions to font.cpp until we have something that is more-or-less self-contained.

The ultimate step would be to swap out FreeTypeAmalgam with stb_truetype.

@a740g a740g added the enhancement New feature or request label Apr 4, 2023
@@ -265,12 +265,12 @@ else
endif

ifneq ($(filter y,$(DEP_FONT)),)
EXE_LIBS += $(QB_FONT_LIB)
CXXFLAGS += -DDEPENDENCY_LOADFONT
EXE_LIBS += $(FREETYPE_OBJS) $(FONT_OBJS)
QBLIB_NAME := $(addsuffix 1,$(QBLIB_NAME))
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the define is gone we can get rid of the QBLIB_NAME addition as well :) Very good stuff, it puts us one step closer to not having any more conditional compilation for libqb.cpp.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted.

#include "freetypeamalgam.h"
#include "rounding.h"

extern uint16_t codepage437_to_unicode16[];
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this extern should go in font.h. We also might consider moving the actual declaration into this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea.👍 I'll make this change in the next PR.

FONT_STUB_OBJS := $(patsubst %.cpp,$(PATH_INTERNAL_C)/parts/video/font/%.o,$(FONT_STUB_SRCS))

$(PATH_INTERNAL_C)/parts/video/font/%.o: $(PATH_INTERNAL_C)/parts/video/font/%.c
$(CC) -O2 $(CFLAGS) -DDEPENDENCY_CONSOLE_ONLY -Wall $< -c -o $@
Copy link
Contributor

Choose a reason for hiding this comment

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

For these lines you can get rid of the -DDEPENDENCY_CONSOLE_ONLY because none of these files depend on libqb.h (which was causing the problems).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted.

@a740g a740g merged commit b5691c9 into QB64-Phoenix-Edition:main Apr 6, 2023
4 checks passed
a740g added a commit to a740g/QB64pe that referenced this pull request Apr 8, 2023
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.

None yet

3 participants