|
Haru Free PDF Library
|
Functions | |
| HPDF_Font | HPDF_GetFont (HPDF_Doc pdf, const char *font_name, const char *encoding_name) |
| Get requested font object handle. More... | |
| const char * | HPDF_LoadType1FontFromFile (HPDF_Doc pdf, const char *afm_filename, const char *data_filename) |
| Load Type1 font from external file and register it in the document object. More... | |
| const char * | HPDF_LoadTTFontFromFile (HPDF_Doc pdf, const char *filename, HPDF_BOOL embedding) |
Load TrueType font from external .ttf file and register it in the document object. More... | |
| const char * | HPDF_LoadTTFontFromFile2 (HPDF_Doc pdf, const char *filename, HPDF_UINT index, HPDF_BOOL embedding) |
Load TrueType font from TrueType collection file *.ttc and register it in the document object. More... | |
| HPDF_STATUS | HPDF_UseJPFonts (HPDF_Doc pdf) |
| Enable Japanese fonts. Application can use following Japanese fonts after HPDF_UseJPFonts() call: More... | |
| HPDF_STATUS | HPDF_UseKRFonts (HPDF_Doc pdf) |
| Enable Korean fonts. Application can use following Korean fonts after HPDF_UseKRFonts() call: More... | |
| HPDF_STATUS | HPDF_UseCNSFonts (HPDF_Doc pdf) |
| Enable simplified Chinese fonts. Application can use following simplified Chinese fonts after HPDF_UseCNSFonts() call: More... | |
| HPDF_STATUS | HPDF_UseCNTFonts (HPDF_Doc pdf) |
| Enable traditional Chinese fonts. Application can use following traditional Chinese fonts after HPDF_UseCNTFonts() call: More... | |
| const char * | HPDF_Font_GetFontName (HPDF_Font font) |
| Get name of the font. More... | |
| const char * | HPDF_Font_GetEncodingName (HPDF_Font font) |
| Get encoding name of the font. More... | |
| HPDF_INT | HPDF_Font_GetUnicodeWidth (HPDF_Font font, HPDF_UNICODE code) |
| Get width of a Unicode character in a specific font. More... | |
| HPDF_Box | HPDF_Font_GetBBox (HPDF_Font font) |
| Get bounding box of the font. More... | |
| HPDF_INT | HPDF_Font_GetAscent (HPDF_Font font) |
| Get vertical ascent of the font. More... | |
| HPDF_INT | HPDF_Font_GetDescent (HPDF_Font font) |
| Get vertical descent of the font. More... | |
| HPDF_UINT | HPDF_Font_GetXHeight (HPDF_Font font) |
| Get the distance from the baseline and the mean line of lowercase letters in a font. More... | |
| HPDF_UINT | HPDF_Font_GetCapHeight (HPDF_Font font) |
| Get the distance from the baseline and the mean line of uppercase letters in a font. More... | |
| HPDF_TextWidth | HPDF_Font_TextWidth (HPDF_Font font, const HPDF_BYTE *text, HPDF_UINT len) |
| Get total width of the text, number of characters, and number of words. More... | |
| HPDF_UINT | HPDF_Font_MeasureText (HPDF_Font font, const HPDF_BYTE *text, HPDF_UINT len, HPDF_REAL width, HPDF_REAL font_size, HPDF_REAL char_space, HPDF_REAL word_space, HPDF_BOOL wordwrap, HPDF_REAL *real_width) |
| Calculate byte length which can be included within the specified width. More... | |
Routines for font loading and measuring
Get vertical ascent of the font.
| font | Font object handle. |
0. Get bounding box of the font.
| font | Font object handle. |
HPDF_Box{0, 0, 0, 0}. Get the distance from the baseline and the mean line of uppercase letters in a font.
| font | Font object handle. |
0. Get vertical descent of the font.
| font | Font object handle. |
0. | const char* HPDF_Font_GetEncodingName | ( | HPDF_Font | font | ) |
Get encoding name of the font.
| font | Font object handle. |
NULL | const char* HPDF_Font_GetFontName | ( | HPDF_Font | font | ) |
Get name of the font.
| font | Font object handle. |
NULL | HPDF_INT HPDF_Font_GetUnicodeWidth | ( | HPDF_Font | font, |
| HPDF_UNICODE | code | ||
| ) |
Get width of a Unicode character in a specific font.
Actual character width on the page can be calculated as follows:
| font | Font object handle. |
| code | Unicode character |
FONT_SIZE 0 Get the distance from the baseline and the mean line of lowercase letters in a font.
| font | Font object handle. |
0. | HPDF_UINT HPDF_Font_MeasureText | ( | HPDF_Font | font, |
| const HPDF_BYTE * | text, | ||
| HPDF_UINT | len, | ||
| HPDF_REAL | width, | ||
| HPDF_REAL | font_size, | ||
| HPDF_REAL | char_space, | ||
| HPDF_REAL | word_space, | ||
| HPDF_BOOL | wordwrap, | ||
| HPDF_REAL * | real_width | ||
| ) |
Calculate byte length which can be included within the specified width.
| font | Font object handle. |
| text | Text to get width |
| len | Length of the text. |
| width | Width of the area to put text. |
| font_size | The size of the font. |
| char_space | The character spacing value. |
| word_space | The word spacing value. |
| wordwrap | Word wrap flag. When there are three words of "ABCDE", "FGH", and "IJKL", and the substring until "J" can be included within the width, if word_wrap parameter is HPDF_FALSE it returns 12, and if word_wrap parameter is HPDF_TRUE, it returns 10 (the end of the previous word).
|
| real_width | If this parameter is not NULL, the real widths of the text is set. An application can set it to NULL, if it is unnecessary. |
0 and calls error handler.len is byte length or character length?| HPDF_TextWidth HPDF_Font_TextWidth | ( | HPDF_Font | font, |
| const HPDF_BYTE * | text, | ||
| HPDF_UINT | len | ||
| ) |
Get total width of the text, number of characters, and number of words.
| font | Font object handle. |
| text | The text to get width. |
| len | - The byte length of the text. |
HPDF_TextWidth{0, 0, 0, 0}.What is the meaning of fourth param?
Byte length or character length?
Get requested font object handle.
| Document object handle. | |
| font_name | Valid font name. |
| encoding_name | Valid encoding name. |
NULL and calls error handler.Load TrueType font from external .ttf file and register it in the document object.
| Document object handle. | |
| filename | Path of TrueType font file (.ttf) |
| embedding | If this parameter is set to HPDF_TRUE, the glyph data of the font is included to PDF file, otherwise only the matrix data is included to PDF file. |
NULL and calls error handler.| const char* HPDF_LoadTTFontFromFile2 | ( | HPDF_Doc | pdf, |
| const char * | filename, | ||
| HPDF_UINT | index, | ||
| HPDF_BOOL | embedding | ||
| ) |
Load TrueType font from TrueType collection file *.ttc and register it in the document object.
| Document object handle. | |
| filename | Path of TrueType font file (.ttc) |
| index | Index of font in collection to be loaded. |
| embedding | If this parameter is set to HPDF_TRUE, the glyph data of the font is included to PDF file, otherwise only the matrix data is included to PDF file. |
NULL and calls error handler.| const char* HPDF_LoadType1FontFromFile | ( | HPDF_Doc | pdf, |
| const char * | afm_filename, | ||
| const char * | data_filename | ||
| ) |
Load Type1 font from external file and register it in the document object.
| Document object handle. | |
| afm_filename | Path of AFM file |
| data_filename | Path of PFA/PFB file. If NULL, glyph data of font file is not embedded into the PDF file |
NULL and calls error handler.| HPDF_STATUS HPDF_UseCNSFonts | ( | HPDF_Doc | ) |
Enable simplified Chinese fonts. Application can use following simplified Chinese fonts after HPDF_UseCNSFonts() call:
| Font name |
|---|
| SimSun |
| SimSun,Bold |
| SimSun,Italic |
| SimSun,BoldItalic |
| SimHei |
| SimHei,Bold |
| SimHei,Italic |
| SimHei,BoldItalic |
| Document object handle. |
| HPDF_STATUS HPDF_UseCNTFonts | ( | HPDF_Doc | ) |
Enable traditional Chinese fonts. Application can use following traditional Chinese fonts after HPDF_UseCNTFonts() call:
| Font name |
|---|
| MingLiU |
| MingLiU,Bold |
| MingLiU,Italic |
| MingLiU,BoldItalic |
| Document object handle. |
| HPDF_STATUS HPDF_UseJPFonts | ( | HPDF_Doc | ) |
Enable Japanese fonts. Application can use following Japanese fonts after HPDF_UseJPFonts() call:
| Font name |
|---|
| MS-Mincyo |
| MS-Mincyo,Bold |
| MS-Mincyo,Italic |
| MS-Mincyo,BoldItalic |
| MS-Gothic |
| MS-Gothic,Bold |
| MS-Gothic,Italic |
| MS-Gothic,BoldItalic |
| MS-PMincyo |
| MS-PMincyo,Bold |
| MS-PMincyo,Italic |
| MS-PMincyo,BoldItalic |
| MS-PGothic |
| MS-PGothic,Bold |
| MS-PGothic,Italic |
| MS-PGothic,BoldItalic |
| Document object handle. |
| HPDF_STATUS HPDF_UseKRFonts | ( | HPDF_Doc | ) |
Enable Korean fonts. Application can use following Korean fonts after HPDF_UseKRFonts() call:
| Font name |
|---|
| DotumChe |
| DotumChe,Bold |
| DotumChe,Italic |
| DotumChe,BoldItalic |
| Dotum |
| Dotum,Bold |
| Dotum,Italic |
| Dotum,BoldItalic |
| BatangChe |
| BatangChe,Bold |
| BatangChe,Italic |
| BatangChe,BoldItalic |
| Batang |
| Batang,Bold |
| Batang,Italic |
| Batang,BoldItalic |
| Document object handle. |