System fonts folder
CodeStepper

Hi!

I'm working on Windows XP, so system fonts folder is %WINDIR%/fonts
How about other systems?

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.
And folder with fonts

Matthew Leverton

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

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

I try create this, but i need font folders :D

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
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

But i would only detect font installed in system...

Only DETECT ( not LOAD )

Thomas Fjellstrom

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

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

Not all systems have a single font folder. For example, I have /home/matthew/.fonts and /usr/share/fonts/ (with many sub folders).

CodeStepper

this from linux?

But how implement this to detecting font folder, because i have any idea :/

Thomas Fjellstrom

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

Oh, i see now :D
Thank you for help :)

Matthew Leverton

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
CodeStepper

Thanks

Thread #610863. Printed from Allegro.cc