tclhpdf(3) 0.1.0 "tclhpdf Font Handler"

NAME

tclhpdf - tclhpdf Font Handler

TABLE OF CONTENTS

    TABLE OF CONTENTS
    SYNOPSIS
    DESCRIPTION
    COMMANDS
    REFERENCE
    SEE ALSO
    KEYWORDS
    COPYRIGHT

SYNOPSIS

COMMANDS
hpdfFontObj getFontName
hpdfFontObj getEncodingName
hpdfFontObj getUnicodeWidth unichar
hpdfFontObj getBBox
hpdfFontObj getAscent
hpdfFontObj getDescent
hpdfFontObj getXHeight
hpdfFontObj getCapHeight
hpdfFontObj textWidth text len
hpdfFontObj measureText text len width fontsize charspace wordspace wordwrap ?realwidthName?

DESCRIPTION

The Font handler command have subcommands for font handling.

COMMANDS

hpdfFontObj getFontName
getFontName gets the name of the font.

hpdfFontObj getEncodingName
getEncodingName gets the encoding name of the font.

hpdfFontObj getUnicodeWidth unichar
getUnicodeWidth gets the width of a charactor in the font. Actual width of the character on the page can be calculated by the following expressions.

 
set char_width [$font getUnicodeWidth $UNICODE]
set actual_width [expr {$char_width * $FONT_SIZE / 1000.0}]



hpdfFontObj getBBox
getBBox gets the bounding box of the font. It returns a list {left bottom right top}.

hpdfFontObj getAscent
getAscent gets the vertical ascent of the font.

hpdfFontObj getDescent
getDescent gets the vertical descent of the font.

hpdfFontObj getXHeight
getXHeight gets the distance from the baseline of lowercase letters.

hpdfFontObj getCapHeight
getCapHeight gets the distance from the baseline of uppercase letters.

hpdfFontObj textWidth text len
textWidth gets total width of the text, number of charactors and number of the words.

text is the text to get width. len is the char length if the text is string. if the text is bytearray it is the byte length.

If type of text values is bytearray, this function use the value as it is (bytearray). But if the type is not bytearray (string or any), the value is assumed as tcl native string(utf-8) and convert to external encoding(encoding system), then pass to hpdf functions. This may be a little confusion, but it is convenient to set another encoding strings.

hpdfFontObj measureText text len width fontsize charspace wordspace wordwrap ?realwidthName?
measureText calculates the byte length which can be included within the specified width.

text is the text to get width. len is the char length if the text is string. if the text is bytearray it is the byte length. width is the width of the area to put the text. fontsize is the size of the font. charspace is the character spacing. wordspace is the word spacing. wordwrap. 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_FALSE word_wrap parameter is HPDF_FALSE it returns 10 (the end of the previous word).

 
 1  2  3  4  5  6  7  8  9 10 11 12 13 14
 A  B  C  D  E     F  G  H     I  J  K  L
 <-------------------------------->

realwidthName is the variable name. If this parameter is set, the real widths of the text is set.

REFERENCE

SEE ALSO

tclhpdf, tclhpdfAnnotation, tclhpdfDescription, tclhpdfDoc, tclhpdfEncoder, tclhpdfExtGState, tclhpdfFont, tclhpdfImage, tclhpdfOutline, tclhpdfPage

KEYWORDS

pdf

COPYRIGHT

Copyright © 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
Copyright © 2007 OHTSUKA, yoshio <ohtsuka.yoshio@gmail.com>