buggins / dlangui

Cross Platform GUI for D programming language
Boost Software License 1.0
816 stars 121 forks source link

fontFace set only sometimes works? #203

Closed TheGag96 closed 8 years ago

TheGag96 commented 8 years ago

I'm trying to set the font of a SourceEdit to "Source Code Pro" which works just fine when trying it out on the ML editor like this:

VerticalLayout {
    EditBox  {
        fontFace: "Source Code Pro"
    }
}

But my own program is having none of it (even when using that same example as the mainWidget). Also, other features like fontWeight appear to not do anything either. I tried even simulating the editor by having a button parse out that example after clicking it, nothing changed. Not sure what the problem is.

Windows 8.1 64-bit.

buggins commented 8 years ago

Probably, it's because ML editor does not use FreeType, but your program does. FreeType support under windows adds only some limited set of fonts to available fonts list. Once your program built, try to remove libfreetype-6.dll which is placed here by DUB Another solution - specify configuration for dlangui which doesnt have freetype support.

TheGag96 commented 8 years ago

Hm... Removing the .dll didn't seem to do it. How would I configure it to specifically not use freetype? There doesn't seem to be a DONT_USE_FREETYPE anywhere, haha.

buggins commented 8 years ago

You can use dlangui configuration "minimal" - but as well it turns off OpenGL support and uses software renderer. (If software rendering performance is suitable for your app, you can see benefit: less memory consumption) Probably it makes sense to either remove freetype from default windows configuration or create new one with OpenGL but W/O freetype.

TheGag96 commented 8 years ago

This thing is just a simple text editor with some buttons, so I suppose software rendering is okay. However, what stinks is that special characters like ← don't work in the software renderer as button text, but do with freetype. Also, for whatever reason I couldn't set the minimal flag using the SDLang version of dub configs (only a json file would do it). subConfigurations "dlangui" "minimal" would be the right syntax, yes?

buggins commented 8 years ago

dlangui minimal configuration uses just pure Win32 API w/o OpenGL neither FreeType Software renderer may use wither Win32 fonts or Freetype If some character is not visible, it's missing in font. Some improvement needed for font managers, to add missing character substitution / fallback fonts.

buggins commented 8 years ago

I've disabled FREETYPE in default configuration under windows. Now all Windows fonts should be available. Please reopen this issue if it still does not work for you.