# PNMTextMaker

from pandac.PandaModules import PNMTextMaker

Class : PNMTextMaker
Description : This object uses the Freetype library to generate text directly into an image. It is different from the TextNode/DynamicTextFont interface, which use the Freetype library to generate text in the scene graph, to be rendered onscreen via the Panda render traversal.

## Inheritance:

PNMTextMaker: FreetypeFont
FreetypeFont: Namable
Namable:

## Methods of PNMTextMaker:

generateInto
getAlign
getFg
getGlyph
getInterior
getInteriorFlag
isValid
setAlign
setFg
setInterior
setInteriorFlag

## Methods of FreetypeFont:

getFontPixelSize
getLineHeight
getNativeAntialias
getPixelSize
getPixelsPerUnit
getPointSize
getPointsPerInch
getPointsPerUnit
getScaleFactor
getSpaceAdvance
setNativeAntialias
setPixelSize
setPixelsPerUnit
setPointSize
setScaleFactor

## Methods of Namable:

clearName
getClassType
getName
hasName
operator =
output
setName

## Constants in PNMTextMaker:

ALeft | (Alignment)
ARight | (Alignment)
ACenter | (Alignment)

generateInto int PNMTextMaker::generate_into(string const &text, PNMImage &dest_image, int x, int y); Description: Generates a single line of text into the indicated image at the indicated position; the return value is the total width in pixels.

getAlign PNMTextMaker::Alignment PNMTextMaker::get_align(void) const; Description:

getFg LVecBase4f const &PNMTextMaker::get_fg(void) const; Description: Returns the foreground color of text that will be generated by future calls to generate_into().

getGlyph PNMTextGlyph *PNMTextMaker::get_glyph(int character); Description: Returns the glyph for the indicated index, or NULL if it is not defined in the font.

getInterior LVecBase4f const &PNMTextMaker::get_interior(void) const; Description: Returns the color that will be used to render the interior portions of hollow fonts.

getInteriorFlag bool PNMTextMaker::get_interior_flag(void) const; Description:

isValid bool PNMTextMaker::is_valid(void) const; Filename: pnmTextMaker.I Created by: drose (07Sep03) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description: Returns true if the PNMTextMaker is valid and ready to generate text, false otherwise.

setAlign void PNMTextMaker::set_align(PNMTextMaker::Alignment align_type); Description:

setFg void PNMTextMaker::set_fg(LVecBase4f const &fg); Description: Sets the foreground color of text that will be generated by future calls to generate_into(). This is the color that all of the "on" pixels in the font will show as.

setInterior void PNMTextMaker::set_interior(LVecBase4f const &interior); Description: Sets the color that will be used to render the interior portions of hollow fonts in future calls to generate_into(). This is respected only if interior_flag is true.

setInteriorFlag void PNMTextMaker::set_interior_flag(bool interior_flag); Description: Sets the flag that indicates whether the interior of hollow fonts is identified as a preprocess as each glyph is loaded. If this flag is true, you may specify an interior color along with a fg and bg color when you place text; if the flag is false, the interior color is ignored. It is generally best to set_native_antialias(0) when using this feature. Also, this works best when the pixel size is not very small.

getFontPixelSize int FreetypeFont::get_font_pixel_size(void) const; Description: This is used to report whether the requested pixel size is being only approximated by a fixed-pixel-size font. This returns 0 in the normal case, in which a scalable font is used, or the fixed-pixel-size font has exactly the requested pixel size. If this returns non-zero, it is the pixel size of the font that we are using to approximate our desired size.

getLineHeight float FreetypeFont::get_line_height(void) const; Description: Returns the number of units high each line of text is.

getNativeAntialias bool FreetypeFont::get_native_antialias(void) const; Description: Returns whether Freetype's built-in antialias mode is enabled. See set_native_antialias().

getPixelSize float FreetypeFont::get_pixel_size(void) const; Description: Returns the size of the font in pixels, as it appears in the texture.

getPixelsPerUnit float FreetypeFont::get_pixels_per_unit(void) const; Description: Returns the resolution of the texture map. See set_pixels_per_unit().

getPointSize float FreetypeFont::get_point_size(void) const; Description: Returns the point size of the font.

getPointsPerInch static float FreetypeFont::get_points_per_inch(void); Description: Returns the number of points in one inch. This is a universal typographic convention.

getPointsPerUnit static float FreetypeFont::get_points_per_unit(void); Description: Returns the point size of the font that is one Panda unit high. This is an arbitrary Panda convention for text, and is set to 10.0.

getScaleFactor float FreetypeFont::get_scale_factor(void) const; Description: Returns the antialiasing scale factor. See set_scale_factor().

getSpaceAdvance float FreetypeFont::get_space_advance(void) const; Description: Returns the number of units wide a space is.

setNativeAntialias void FreetypeFont::set_native_antialias(bool native_antialias); Description: Sets whether the Freetype library's built-in antialias mode is enabled. There are two unrelated ways to achieve antialiasing: with Freetype's native antialias mode, and with the use of a scale_factor greater than one. By default, both modes are enabled. At low resolutions, some fonts may do better with one mode or the other. In general, Freetype's native antialiasing will produce less blurry results, but may introduce more artifacts.

setPixelSize bool FreetypeFont::set_pixel_size(float pixel_size); Description: Computes the appropriate pixels_per_unit value to set the size of the font in the texture to the indicated number of pixels. This is just another way to specify pixels_per_unit().

setPixelsPerUnit bool FreetypeFont::set_pixels_per_unit(float pixels_per_unit); Description: Set the resolution of the texture map, and hence the clarity of the resulting font. This sets the number of pixels in the texture map that are used for each onscreen unit. Setting this number larger results in an easier to read font, but at the cost of more texture memory. This should only be called before any characters have been requested out of the font, or immediately after calling clear().

setPointSize bool FreetypeFont::set_point_size(float point_size); Description: Sets the point size of the font. This controls the apparent size of the font onscreen. By convention, a 10 point font is about 1 screen unit high. This should only be called before any characters have been requested out of the font, or immediately after calling clear().

setScaleFactor bool FreetypeFont::set_scale_factor(float scale_factor); Description: Sets the factor by which the font is rendered larger by the FreeType library before being filtered down to its actual size in the texture as specified by set_pixels_per_unit(). This may be set to a number larger than 1.0 to improve the font's antialiasing (since FreeType doesn't really do a swell job of antialiasing by itself). There is some performance implication for setting this different than 1.0. This should only be called before any characters have been requested out of the font, or immediately after calling clear().

clearName void Namable::clear_name(void); Description: Resets the Namable's name to empty.

getClassType static TypeHandle Namable::get_class_type(void); Undocumented function.

getName string const &Namable::get_name(void) const; Description:

hasName bool Namable::has_name(void) const; Description: Returns true if the Namable has a nonempty name set, false if the name is empty.

operator = Namable &Namable::operator =(Namable const &other); Description:

output void Namable::output(ostream &out) const; In the absence of any definition to the contrary, outputting a Namable will write out its name. Description: Outputs the Namable. This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.

setName void Namable::set_name(string const &name); Description: