[Fontconfig] RFC: new API proposal for FcPattern iterator
akira at tagoh.org
Mon Sep 24 19:28:30 PDT 2012
I had that idea before. but I didn't take that way because:
1. Returning available objects with FcStrSet requires the memory
allocation. it may be not handy when one doesn't need to have a look
2. There are the use case checking with FcPatternGet*() if FcPattern
has the certain objects. this takes a little cost to do with them nor
that idea due to the above reason. we could have another API to check
it. but FcPatternGet*() eventually tries to find it out internally. so
it may be duplicate on work.
So as the developer, I personally failed to find any useful. current
proposal can do things with same or near costs to current
implementation. so FcPatternGet*() might be replaced by them in the
I may be missing something else. if I'm wrong, please correct me.
On Tue, Sep 25, 2012 at 9:26 AM, Behdad Esfahbod <behdad at behdad.org> wrote:
> Hi Akira,
> My gut feeling is that that's a lot of API for usecases we don't fully have in
> mind. How about a much simpler API to return a FcStringSet from a pattern?
> On 09/12/2012 09:33 PM, Akira TAGOH wrote:
>> I'm working on adding new API to iterate things in FcPattern now:
>> and proposing following APIs:
>> int FcPatternObjectCount (const FcPattern *pat)
>> Returns the number of the object in FcPattern.
>> void FcPatternIterStart (const FcPattern *pat, FcPatternIter *iter)
>> Initialize the iterator with the first iterator in FcPattern.
>> FcBool FcPatternIterNext (const FcPattern *pat, FcPatternIter *iter)
>> Set the iterator to point to the next object in FcPattern.
>> FcBool FcPatternIterEqual (const FcPattern *p1, FcPatternIter *i1,
>> const FcPattern *p2, FcPatternIter *i2)
>> Check if both iterators point to same object and contain same value.
>> FcBool FcPatternFindIter (const FcPattern *pat, FcPatternIter *iter,
>> const char *object)
>> Set the iterator to point to the object in FcPattern if any and
>> return FcTrue. return FcFalse otherwise.
>> FcBool FcPatternIterIsValid (const FcPattern *pat, FcPatternIter *iter)
>> Check if the iterator point to the valid entry in FcPattern. return
>> FcFalse otherwise.
>> const char *FcPatternIterGetObject (const FcPattern *pat, FcPatternIter *iter)
>> Return the object name in FcPattern which the iterator point to.
>> int FcPatternIterValueCount (const FcPattern *pat, FcPatternIter *iter)
>> Return the number of the values in the object which the iterator point to.
>> void FcPatternIterGetValue (const FcPattern *pat, FcPatternIter *iter,
>> int id, FcValue *v)
>> Return in FcValue nth value which the iterator point to.
>> Any comments and suggestions etc are welcome.
More information about the Fontconfig