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

make FONTFILE=verabd.h ... embeds the font correctly, but loading fails #56

Open
jmaibaum opened this issue Aug 3, 2018 · 4 comments
Open

Comments

@jmaibaum
Copy link

jmaibaum commented Aug 3, 2018

Hi @x42

I read your comment to #54 that setting FONTFILE=verabd.h should include the font into the GUI applications.

However, this doesn't hold true for the main GUI application, which even in case of FONTFILE=verabd.h tries to load the font from the default path given in common.mak.

This is a problem if, like on ArchLinux, the standard font path is different from the standard Debian path that is given in common.mak.

Would it be possible to allow embedding the font in every GUI application with FONTFILE=verabd.h?
Or else, could you suggest the "right way" how to both embed the font in the LV2 plugin and use another path to your system font?

@x42
Copy link
Collaborator

x42 commented Aug 3, 2018

Oh dear. I just noticed that it needs a -DBUILTINFONT and a patch to ftgl to expose the function to load fonts from memory:

index b23e787..03ee840 100644
--- a/src/FTFont/FTFontGlue.cpp
+++ b/src/FTFont/FTFontGlue.cpp
@@ -57,6 +57,9 @@ C_TOR(ftglCreateBitmapFont, (const char *fontname),
 C_TOR(ftglCreateBufferFont, (const char *fontname),
       FTBufferFont, (fontname), FONT_BUFFER);
 
+C_TOR(ftglCreateBufferFontMem, (const unsigned char *pBufferBytes, size_t bufferSizeInBytes),
+      FTBufferFont, (pBufferBytes,bufferSizeInBytes), FONT_BUFFER);
+
 // FTExtrudeFont::FTExtrudeFont();
 C_TOR(ftglCreateExtrudeFont, (const char *fontname),
       FTExtrudeFont, (fontname), FONT_EXTRUDE);
diff --git a/src/FTGL/FTBufferFont.h b/src/FTGL/FTBufferFont.h
index 15d358d..b3d40ab 100644
--- a/src/FTGL/FTBufferFont.h
+++ b/src/FTGL/FTBufferFont.h
@@ -92,6 +92,7 @@ FTGL_BEGIN_C_DECLS
  * @see  FTGLfont
  */
 FTGL_EXPORT FTGLfont *ftglCreateBufferFont(const char *file);
+FTGL_EXPORT FTGLfont *ftglCreateBufferFontMem(const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
 
 FTGL_END_C_DECLS

It's probably not viable to do this for distros.

@jmaibaum
Copy link
Author

jmaibaum commented Aug 3, 2018

So, without a patched ftgl, embedding the font (or rather loading the embedded font) does also not work in the LV2 plugin?

I had not yet tested to run the LV2 plugin, but only noticed the missing font while running setBfreeUI after having compiled with FONTFILE=verabd.h.

@x42
Copy link
Collaborator

x42 commented Aug 3, 2018

So, without a patched ftgl, embedding the font (or rather loading the embedded font) does also not work in the LV2 plugin?

That is correct. Also note that setBfreeUI is just the plugin with a small jack-wrapper/LV2 host.

You can verify what font-file is opened via
strace -e trace=open jalv.gtk http://gareus.org/oss/lv2/b_synth
and/or
strace -e trace=open ./ui/setBfreeUI

(press '?' to show the help-text for example, or "shift +L" .. and see if there's any rendered text)

I guess for GNU/Linux distributions it is easiest to use a system-wide font-file for the given distro.

@jmaibaum
Copy link
Author

jmaibaum commented Aug 4, 2018

Alright, thanks for the information.

Yep, it always tries to load from the provided system path, which is wrong if I set FONTFILE=verabd.h at build time and thus the font fails to load, and which works correctly if I provide the standard Arch Linux path in FONTFILE.

From my point of view this ticket might then be closed as upstream bug, if the root cause is the missing visibility of ftglCreateBufferFontMem() in the ftgl toolkit? But I will leave the final decision up to you as the project maintainer.

I'll update the issue title accordingly.

@jmaibaum jmaibaum changed the title make FONTFILE=verabd.h ... is not embedding font in all GUI parts make FONTFILE=verabd.h ... embeds correctly, but loading the font fails Aug 4, 2018
@jmaibaum jmaibaum changed the title make FONTFILE=verabd.h ... embeds correctly, but loading the font fails make FONTFILE=verabd.h ... embeds the font correctly, but loading fails Aug 4, 2018
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

No branches or pull requests

2 participants