XML/SWF Slideshow  2.64 | XML/SWF Charts | SlickBoard(New)

 < previousnext > 

 

draw_text

 

<draw_text> 

   <text x='int'
         y='int'
         width='int'  
         height='int' 
         align='string' 
         rotation='int' 
         font='string'
         bold='boolean' 
         size='int'
         color='string' 
         alpha='int'
         >text to draw</text>
             
         ...

</draw_text>


Description

draw_text holds any number of other text elements, each setting the attributes of a text to draw.

To draw a text, it's necessary to define an invisible rectangle to draw it in. This rectangle determines the text's location, alignment, and rotation.

Text is drawn over the slide's image, over elements drawn with draw_rect, over elements drawn with draw_circle, and over elements drawn with draw_line.

Text is animated by transition, but isn't affected by motion.

 

  • x: The horizontal position of the rectangle's upper left corner relative to the upper left corner of the canvas (0, 0). The default is zero

  • y: The vertical position of the rectangle's upper left corner relative to the upper left corner of the canvas (0, 0). The default is zero

  • width: The rectangle's width. The default is the canvas width. If the text doesn't fit in one line, it wraps and fills other lines

  • height: The rectangle's height. The default is the canvas height

  • align: The text's horizontal alignment inside the rectangle. Valid values are "left", "center", and "right." The default is "left"

  • rotation: The rectangle's rotation. The rectangle rotates around its upper left point (x, y). The default value is zero

  • font: The font used for draw the text. Valid values are Arial, and Times. The default is Arial

  • bold: A boolean value that indicates whether the font is bold or not. The default is true

  • size: The font size. The default font size is 24

  • color: The font color. This must be a string holding triple hexadecimal values representing the red, green and blue components for a color. The default is "000000" (black)

  • alpha: The font transparency value. Valid values are 0 (fully transparent) to 100 (fully opaque). The default is 100

 


Multi-line Text

To draw multi-line text, break the text with \r. Example: "Show this in\rtwo lines".

 


Fonts

XML/SWF Slideshow has the font Arial bold embedded in it. By setting the above font attribute to Arial, and the bold attribute to true, the embedded font makes the text look identical on all machines, regardless of whether the machine has this font or not. Other advantages of an embedded font is that it can be rotated, and it can be rendered transparently. The disadvantage is that it increases the size of the flash file, the reason why the tool only has one embedded font. (The gallery only uses this font.)

You may set the above font attribute to any other non-embedded font. If the local machine doesn't have the exact font, Flash uses whatever font most closely resembles it. Non-embedded fonts may look different than expected, but can be sharper and more legible than embedded fonts at small point sizes (below 10 points.)

When non-embedded fonts are used, any rotation and alpha attributes are ignored. Text using a non-embedded font is always displayed horizontally, and fully opaque.

One way to display any text without worrying about fonts is by including rendered text in image files.

 

Special Characters

To display special characters or languages other than English:

1. Type the special characters in the source file, and apply a font to it that can display the characters:

<draw_text> 
   <text font='special_font'>special_text</text>
</draw_text>

Replace special_font with the name of a font that can display the special characters. This must be a font other than Arial, and the font name must be typed exactly the way it is referred to by the operating system. Replace special_text with the text containing the special characters. The special characters must appear correctly here.

2. Save the source file with UTF-8 encoding. When saving the file, examine the saving options that the text editor offers. One option should be a checkbox to make the file UTF-8. If your text editor doesn't provide this option, then find another editor that does.

3. View the chart on a machine that has the same special font already installed.

 


Example


<slideshow>

   <!-- add 2 slides -->
   <!-- draw 2 texts in the first slide -->
   <slide>
      <image url='images/plant0.jpg' />
      
      <draw_text> 
         <text x='0' 
               y='0'
               width='320'
               height='100'
               align='center'
               rotation='0' 
               font='Arial'
               bold='true' 
               size='80'
               color='000000'
               alpha='90'
               >My Title</text>
             
         <text x='0' 
               y='240'
               width='400'
               height='250'
               align='left'
               rotation='-90' 
               font='Arial'
               bold='true' 
               size='35'
               color='ffffff'
               alpha='90'
               >page\r#1</text>
      </draw_text>
         
   </slide>
   
   <slide>
      <image url='images/plant1.jpg' />
   </slide>
	
</slideshow>

 

For more examples, see the gallery section and click the link below each slideshow to see the PHP code.

 

 < previousnext > 


Copyright © 2004-2013, maani.us