Bug 48755 - API redesign
Summary: API redesign
Status: RESOLVED MOVED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2.9
Hardware: Other All
: lowest enhancement
Assignee: fontconfig-bugs
QA Contact: Behdad Esfahbod
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-16 01:26 UTC by Akira TAGOH
Modified: 2018-08-20 21:44 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Akira TAGOH 2012-04-16 01:26:06 UTC
there are some cases I feel an urge to cleanup/redesign fontconfig API though, let me add a note here for a chance to do so in the future.

1. the API prefix isn't intuitive to find out where it's included in.
   e.g. FcDirCache* in fccache.c but some is in fcdir.c. and some can see in fcfs.c, fslist.c and fcmatch.c. for FcFontSet as well.
2. some APIs is hard to imagine the functionality from the name
   e.g. FcDirCacheRead() vs FcDirCacheLoad()
3. FcCacheDir() vs FcConfigGetCacheDirs()
   it implies from the name it may behaves similarly but FcCacheDir() returns the font directory at this moment.
4. function doesn't take any structure as its prefix implies
   e.g. FcConfigFilename() etc
5. FcConfigAppFontAddFile() and FcConfigAppFontAddDir()
   that could be integrated into one and branch if it's a file or a directory?
6. In doc, FcConfigSubstitute() and FcDefaultSubstitute() are required to get FcFontMatch() and FcFontSort() working though, it's actually optional to do in the program. guess there may be a reason to do so but that looks to me like an error of API design.

may update more later...
Comment 1 Akira TAGOH 2013-01-23 08:34:38 UTC
Another thing is FcConfigGetConfigDirs() and FcConfigGetFontDirs().

From the name of FcConfigGetConfigDirs() implies the list of the configuration directories. but it:

Returns the list of font directories specified in the configuration files for config. Does not include any subdirectories.

and in the man page of FcConfigGetFontDirs():

Returns the list of font directories in config. This includes the configured font directories along with any directories below those in the filesystem.

That looks like a duplicate or can be merged into one API perhaps and we may want to have the new FcConfigGetConfigDirs() that returns the configuration directories specified with <include> in the config file
Comment 2 Behdad Esfahbod 2013-02-05 02:08:58 UTC
In general, API cleanup belongs to fontconfig 3 in my opinion.
Comment 3 Behdad Esfahbod 2013-02-05 02:09:39 UTC
That, and the Cache API really is mostly an implementation detail of fc-cache.  Perhaps it should become completely internal and fc-cache become a special program that has access to it.
Comment 4 Akira TAGOH 2013-02-05 02:15:04 UTC
(In reply to comment #2)
> In general, API cleanup belongs to fontconfig 3 in my opinion.

Right. this is just a note to help the discussion coming in the future.
Comment 5 GitLab Migration User 2018-08-20 21:44:18 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/17.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.