Loading fonts from memory

33 views
Skip to first unread message

Tobias Widlund

unread,
Oct 4, 2013, 7:18:49 AM10/4/13
to freet...@googlegroups.com
Hello!

I am wondering if there is anyone who has successfully used freetype-gl to load a font not from filename, but from a char* array containing the font data. As I've seen, the API only allows the filename.

Loading from memory is a really useful feature in many cases. A few examples being if you have all assets for an application (images, fonts, text, etc) stored in a single compressed resource file, or if the font is being received over a network stream, or if all resource loading happens in a specific part of the application and then being passed to the correct parts, etc.

Perhaps this could be a feature added to freetype-gl? I could myself help writing this but I would need discussion to see what people think, and how it could be done in the best way.

What do you think?

Regards, Tobias

Nicolas Rougier

unread,
Oct 4, 2013, 7:56:43 AM10/4/13
to freet...@googlegroups.com

I think someone proposed this some time ago and only the svn stuff prevent me from integrating it. If you dig into this group you might find the code.

Nicolas

Tobias Widlund

unread,
Oct 4, 2013, 8:21:05 AM10/4/13
to freet...@googlegroups.com
Hmmm I am not sure where that would be. I have skimmed through all 22 posts in this group and I saw nothing related to font loading from memory. Is there another forum somewhere else than google groups where it might be?

Behdad Esfahbod

unread,
Oct 4, 2013, 10:12:42 AM10/4/13
to freet...@googlegroups.com

On Oct 4, 2013 8:21 AM, "Tobias Widlund" <widlun...@gmail.com> wrote:
>
> Hmmm I am not sure where that would be. I have skimmed through all 22 posts in this group and I saw nothing related to font loading from memory. Is there another forum somewhere else than google groups where it might be?

FT_New_Memory_Face().
http://www.freetype.org/freetype2/docs/tutorial/step1.html

behdad


>
>
> On Friday, October 4, 2013 1:56:43 PM UTC+2, Nicolas Rougier wrote:
>>
>>
>> I think someone proposed this some time ago and only the svn stuff prevent me from integrating it. If you dig into this group you might find the code.
>>
>> Nicolas
>>
>>
>>
>> On Friday, October 4, 2013 1:18:49 PM UTC+2, Tobias Widlund wrote:
>>>
>>> Hello!
>>>
>>> I am wondering if there is anyone who has successfully used freetype-gl to load a font not from filename, but from a char* array containing the font data. As I've seen, the API only allows the filename.
>>>
>>> Loading from memory is a really useful feature in many cases. A few examples being if you have all assets for an application (images, fonts, text, etc) stored in a single compressed resource file, or if the font is being received over a network stream, or if all resource loading happens in a specific part of the application and then being passed to the correct parts, etc.
>>>
>>> Perhaps this could be a feature added to freetype-gl? I could myself help writing this but I would need discussion to see what people think, and how it could be done in the best way.
>>>
>>> What do you think?
>>>
>>> Regards, Tobias
>

> --
> You received this message because you are subscribed to the Google Groups "freetype-gl" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to freetype-gl...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Tobias Widlund

unread,
Oct 4, 2013, 11:48:41 AM10/4/13
to freet...@googlegroups.com
But that function is in freetype, and not part of the freetype-gl API? How would I then use it with freetype-gl's font API?

Nicolas Rougier

unread,
Oct 4, 2013, 11:56:58 AM10/4/13
to freet...@googlegroups.com

The best would be to add the same functionality into freetype-gl.

Nico

On Oct 4, 2013, at 5:48 PM, Tobias Widlund <widlun...@gmail.com> wrote:

> But that function is in freetype, and not part of the freetype-gl API? How
> would I then use it with freetype-gl's font API?
>
> On Friday, October 4, 2013 4:12:42 PM UTC+2, behdad wrote:
>>
>> On Oct 4, 2013 8:21 AM, "Tobias Widlund" <widlun...@gmail.com<javascript:>>
>> an email to freetype-gl...@googlegroups.com <javascript:>.

Behdad Esfahbod

unread,
Oct 4, 2013, 12:50:35 PM10/4/13
to freet...@googlegroups.com
On 13-10-04 11:48 AM, Tobias Widlund wrote:
> But that function is in freetype, and not part of the freetype-gl API? How
> would I then use it with freetype-gl's font API?

Just change texture_font_load_face() to take an opened FT_Face instead.


> On Friday, October 4, 2013 4:12:42 PM UTC+2, behdad wrote:
>
> On Oct 4, 2013 8:21 AM, "Tobias Widlund" <widlun...@gmail.com
> an email to freetype-gl...@googlegroups.com <javascript:>.
> > For more options, visit https://groups.google.com/groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "freetype-gl" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to freetype-gl...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

--
behdad
http://behdad.org/

Nicolas Rougier

unread,
Oct 4, 2013, 9:03:50 AM10/4/13
to freet...@googlegroups.com


Sorry, the post is issue #33 in fact:

http://code.google.com/p/freetype-gl/issues/detail?id=33


Nicolas
Reply all
Reply to author
Forward
0 new messages