freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] How to port freetype2 to a system without file system


From: duhuanpeng
Subject: Re: [ft-devel] How to port freetype2 to a system without file system
Date: Tue, 13 Mar 2018 10:19:30 +0800

Hi, I want to paste the source code here, for people in the future.

  /*************************************************************************/
  /*                                                                       */
  /* <Function>                                                            */
  /*    FT_New_Memory_Face                                                 */
  /*                                                                       */
  /* <Description>                                                         */
  /*    Call @FT_Open_Face to open a font that has been loaded into        */
  /*    memory.                                                            */
  /*                                                                       */
  /* <InOut>                                                               */
  /*    library    :: A handle to the library resource.                    */
  /*                                                                       */
  /* <Input>                                                               */
  /*    file_base  :: A pointer to the beginning of the font data.         */
  /*                                                                       */
  /*    file_size  :: The size of the memory chunk used by the font data.  */
  /*                                                                       */
  /*    face_index :: See @FT_Open_Face for a detailed description of this */
  /*                  parameter.                                           */
  /*                                                                       */
  /* <Output>                                                              */
  /*    aface      :: A handle to a new face object.  If `face_index' is   */
  /*                  greater than or equal to zero, it must be non-NULL.  */
  /*                                                                       */
  /* <Return>                                                              */
  /*    FreeType error code.  0~means success.                             */
  /*                                                                       */
  /* <Note>                                                                */
  /*    You must not deallocate the memory before calling @FT_Done_Face.   */
  /*                                                                       */
  FT_EXPORT( FT_Error )
  FT_New_Memory_Face( FT_Library      library,
                      const FT_Byte*  file_base,
                      FT_Long         file_size,
                      FT_Long         face_index,
                      FT_Face        *aface );


-----Original Message-----
From: Freetype-devel [mailto:address@hidden On Behalf Of duhuanpeng
Sent: Monday, March 12, 2018 11:25 PM
To: address@hidden
Subject: [ft-devel] How to port freetype2 to a system without file system

Hello,

I have ported freetype2 to our system. Our system don't supports file system, 
so I write some functions to emulate file operations.
> fopen,  fread, etc.
But now I maintain a "FILE" array, it eats a lot memory.

Is there any better way to port freetype2? 
Our fonts are store in flash, it appears like a normal array.
like:
  extern char font1[];
  extern char font2[];


(actually, I store multi font files in a single romfs image block.)

Regards,
duhuanpeng





_______________________________________________
Freetype-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/freetype-devel







reply via email to

[Prev in Thread] Current Thread [Next in Thread]