List_Bullet_Frame_Decorator

Decorates frames for list bullet rendering.

Defined (1)

The class is defined in the following location(s).

/lib/dompdf/include/list_bullet_frame_decorator.cls.php  
  1. class List_Bullet_Frame_Decorator extends Frame_Decorator { 
  2.  
  3. const BULLET_PADDING = 1; // Distance from bullet to text in pt 
  4. // As fraction of font size (including descent). See also DECO_THICKNESS. 
  5. const BULLET_THICKNESS = 0.04; // Thickness of bullet outline. Screen: 0.08, print: better less, e.g. 0.04 
  6. const BULLET_DESCENT = 0.3; //descent of font below baseline. Todo: Guessed for now. 
  7. const BULLET_SIZE = 0.35; // bullet diameter. For now 0.5 of font_size without descent. 
  8.  
  9. static $BULLET_TYPES = array("disc", "circle", "square"); 
  10.  
  11. //........................................................................ 
  12.  
  13. function __construct(Frame $frame, DOMPDF $dompdf) { 
  14. parent::__construct($frame, $dompdf); 
  15.  
  16. function get_margin_width() { 
  17. $style = $this->_frame->get_style(); 
  18.  
  19. // Small hack to prevent extra indenting of list text on list_style_position === "inside" 
  20. // and on suppressed bullet 
  21. if ( $style->list_style_position === "outside" || 
  22. $style->list_style_type === "none" ) { 
  23. return 0; 
  24.  
  25. return $style->get_font_size() * self::BULLET_SIZE + 2 * self::BULLET_PADDING; 
  26.  
  27. //hits only on "inset" lists items, to increase height of box 
  28. function get_margin_height() { 
  29. $style = $this->_frame->get_style(); 
  30.  
  31. if ( $style->list_style_type === "none" ) { 
  32. return 0; 
  33.  
  34. return $style->get_font_size() * self::BULLET_SIZE + 2 * self::BULLET_PADDING; 
  35.  
  36. function get_width() { 
  37. return $this->get_margin_height(); 
  38.  
  39. function get_height() { 
  40. return $this->get_margin_height(); 
  41.  
  42. //........................................................................