We could make it work without such extra marker. One way would be to always allocate entries array of pointers for a new font set object, and copy existing arrays to it, addrefing entries. Another way is to add another layer with `"struct dwrite_fontset_entries { refcount; struct dwrite_fontset_entry **entries; entry_count };"` This way you'd create such structure once and can referencing it easily without copies.
There are two different cases:
- collection -> get_fontset. That gets you a complete set every time, but different instance of dwrite outer object implementing IDWriteFontSet; - fontset -> getmatchingfonts. That produces a subset, so you would create a new "struct dwrite_fontset_entries" if matching count does not equal full set count. If it's a smaller subset you'll have to go trough a loop to addref entries.
But in collection -> GetFontSet() case you only need to allocate "struct fontset", set a pointer to "struct dwrite_fontset_entries *", and addref just fontset_entries, no need to loop.
Let me know what you think, or if something is unclear.