DynaPDF Manual - Page 520

Previous Page 519   Index   Next Page 521

Function Reference
Page 520 of 821
Human readable text
Many barcodes consist of the barcode and a human readable text portion that is mostly drawn
below the barcode. In image mode it is possible to adjust the font size and font weight with the flags
bcoSmallText and bcoBoldText. More options are not available in image mode.
In vector mode, we have more control over the text. The default font for text is the standard font
Helvetica but it is possible to change it to an arbitrary font by setting the flag bsoUseActiveFont.
When this flag is set the active font is used to output the text. This font should be loaded with the
code page cp1252 or cpUnicode. If no font is active the function falls back again to Helvetica. This font
is always available unless it was disabled with SetUseStdFonts() or SetFontSearchOrder(). Note that
the function fails with a fatal error if no font can be loaded when text must be drawn.
The function tries to achieve an almost identical result in comparison to the image version of a
barcode. This required a bit fine tuning by adjusting the font size and vertical text position. The font
size scaling factor (member FSizeFactor) is set to 0.7 by default but it can be set to values between 0.3
through 3.0. However, the text cannot become wider as the barcode. The font size will be decreased
if the text does not fit into the barcode width. Setting the scaling factor to an unneccesary large value
increases the processing time.
The vertical text position can be adjusted with the member TextOffsetY.
Outer border
The member OuterBorder can be used to extend the background rectangle. Each side of OuterBorder
specifies the line width of the corresponding side of the rectangle. OuterBorder is measured in user
space whereas BorderWidth is measured in pixels of the reference grid (see Scaling Details below).
Note that the background rectangle is drawn only if BgColor is set to another value than
NO_COLOR (default).
Scaling details
Barcodes are rendered internally to a virtual integer raster that we call reference grid. Although the
width and height of the reference grid is mostly unknown, the height of lines or bars of 1D codes
can be controlled with the member SymbHeight and the amount of space between bars can be
adjusted with SpaceWidth. Both values are measured in pixels of the reference grid.
The default symbol height of 1D barcodes is 50. The default space width is just zero since
meaningful values depend on the barcode type.
The full height of a 1D barcode is the height of the bars plus optional text, that is mostly drawn
below the code. The default font size is 8 for image based barcodes and 9 for vector based barcodes.
Although not every part of a barcode can be scaled freely, with SymbHeight and SpaceWidth it is
possible to control the proportions of a barcode precise enough to achieve reasonable results.

Previous topic: Vector vs. Image Barcodes, Output resolution, Background and foreground colors

Next topic: Special options

Start Chat