|
System fonts folder |
CodeStepper
Member #14,495
August 2012
|
Hi! I'm working on Windows XP, so system fonts folder is %WINDIR%/fonts I would be very grateful, if someone gave me a path, which, that returns this function: ALLEGRO_PATH *path = al_get_standard_path( ALLEGRO_USER_HOME_PATH ); std::string home = al_path_cstr( path, ALLEGRO_NATIVE_PATH_SEP ); path = al_create_path_for_directory( home.c_str( ) );
Specifically, variable path value. |
Matthew Leverton
Supreme Loser
January 1999
|
Allegro doesn't support font folders. Ideally there would be an API like: q = al_create_font_query("sans-serif"); while ((font_info = al_find_font(q))) { printf("Font %s lives at %s\n", font_info->name, font_info->path); } al_destroy_font_query(q); along with helper functions to find or load the font that best matches the query. |
Thomas Fjellstrom
Member #476
June 2000
|
If added as an addon I could see it having a function to return an ALLEGRO_FONT and use the system font loader as an option. -- |
CodeStepper
Member #14,495
August 2012
|
I try create this, but i need font folders I need only path to system font folders, because i create function, which collect font informations and path to font ( i have an idea ) but i have font folder only for XP |
Thomas Fjellstrom
Member #476
June 2000
|
Quote: I try create this, but i require font folders It would have to be part of that code. It would use platform specific code internally to find the fonts and/or font folders. Ideally you wouldn't even need the font folders. You'd ask the operating system for fonts, and it would deal with finding them. -- |
CodeStepper
Member #14,495
August 2012
|
But i would only detect font installed in system... Only DETECT ( not LOAD ) |
Thomas Fjellstrom
Member #476
June 2000
|
CodeStepper said: But i would only detect font installed in system... Right, and the best way to do that would be to ask the OS for the font or a list of fonts, instead of looking in various font folders -- |
CodeStepper
Member #14,495
August 2012
|
But i think, my idea is simple... ALLEGRO_PATH *path = al_get_standard_path( ALLEGRO_USER_HOME_PATH ); std::string home = al_path_cstr( path, ALLEGRO_NATIVE_PATH_SEP ); home.append( "..\\..\\WINDOWS\\fonts" ); path = al_create_path_for_directory( home.c_str( ) ); But this is only for xp I missunderstand you at this moment... sorry |
Matthew Leverton
Supreme Loser
January 1999
|
Not all systems have a single font folder. For example, I have /home/matthew/.fonts and /usr/share/fonts/ (with many sub folders). |
CodeStepper
Member #14,495
August 2012
|
this from linux? But how implement this to detecting font folder, because i have any idea :/ |
Thomas Fjellstrom
Member #476
June 2000
|
CodeStepper said: But how implement this to detecting font folder, because i have any idea :/ Instead of detecting the font folder, just find an API (a function) from the OS that lets you get a list of fonts. Like font names and their locations. Maybe even support loading the font directly with this addon (using the OS interfaces) but thats not really all that important. -- |
CodeStepper
Member #14,495
August 2012
|
Oh, i see now |
Matthew Leverton
Supreme Loser
January 1999
|
I think you'd have to interface with the fontconfig library to do a proper job on Linux. To write a proper Allegro add-on (or to update the current font add-on), you'd want to take a look at all of the systems Allegro supports and see if there is a common subset of functionality that could be provided across all of them. i.e., The goal wouldn't be to expose all of the features of fontconfig, but to solve the most common use case of querying available fonts. |
jmasterx
Member #11,410
October 2009
|
Agui GUI API -> https://github.com/jmasterx/Agui |
CodeStepper
Member #14,495
August 2012
|
Thanks |
|