[ PHPXref.com ] [ Generated: Sun Jul 20 17:19:34 2008 ] [ dompdf 0.5 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/include/ -> style.cls.php (summary)

DOMPDF - PHP5 HTML to PDF renderer File: $RCSfile: style.cls.php,v $ Created on: 2004-06-01

Author: Benj Carson
Copyright: 2004 Benj Carson
Version: 0.3
File Size: 1615 lines (43 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Style:: (61 methods):
  __construct()
  dispose()
  get_stylesheet()
  length_in_pt()
  inherit()
  merge()
  munge_colour()
  munge_color()
  __set()
  __get()
  get_font_family()
  get_font_size()
  get_word_spacing()
  get_line_height()
  get_color()
  get_background_color()
  get_background_position()
  get_border_top_color()
  get_border_right_color()
  get_border_bottom_color()
  get_border_left_color()
  get_border_top_width()
  get_border_right_width()
  get_border_bottom_width()
  get_border_left_width()
  get_border_properties()
  _get_border()
  get_border_top()
  get_border_right()
  get_border_bottom()
  get_border_left()
  get_border_spacing()
  set_color()
  set_background_color()
  set_background_image()
  set_font_size()
  set_page_break_before()
  set_page_break_after()
  set_margin_top()
  set_margin_right()
  set_margin_bottom()
  set_margin_left()
  set_margin()
  set_padding_top()
  set_padding_right()
  set_padding_bottom()
  set_padding_left()
  set_padding()
  _set_border()
  set_border_top()
  set_border_right()
  set_border_bottom()
  set_border_left()
  set_border()
  set_border_width()
  set_border_color()
  set_border_style()
  set_border_spacing()
  set_list_style_image()
  set_list_style()
  __toString()


Class: Style  - X-Ref

Represents CSS properties.

The Style class is responsible for handling and storing CSS properties.
It includes methods to resolve colours and lengths, as well as getters &
setters for many CSS properites.

Actual CSS parsing is performed in the {@link Stylesheet} class.

__construct(Stylesheet $stylesheet)   X-Ref
Class constructor

param: Stylesheet $stylesheet the stylesheet this Style is associated with.

dispose()   X-Ref
"Destructor": forcibly free all references held by this object


get_stylesheet()   X-Ref
returns the {@link Stylesheet} this Style is associated with.

return: Stylesheet

length_in_pt($length, $ref_size = null)   X-Ref
Converts any CSS length value into an absolute length in points.

length_in_pt() takes a single length (e.g. '1em') or an array of
lengths and returns an absolute length.  If an array is passed, then
the return value is the sum of all elements.

If a reference size is not provided, the default font size is used
({@link Style::$default_font_size}).

param: float|array $length   the length or array of lengths to resolve
param: float       $ref_size  an absolute reference size to resolve percentage lengths
return: float

inherit(Style $parent)   X-Ref
Set inherited properties in this style using values in $parent

param: Style $parent

merge(Style $style)   X-Ref
Override properties in this style with those in $style

param: Style $style

munge_colour($colour)   X-Ref
Returns an array(r, g, b, "r"=> r, "g"=>g, "b"=>b, "hex"=>"#rrggbb")
based on the provided CSS colour value.

param: string $colour
return: array

munge_color($color)   X-Ref
Alias for {@link Style::munge_colour()}

param: string $color
return: array

__set($prop, $val)   X-Ref
PHP5 overloaded setter

This function along with {@link Style::__get()} permit a user of the
Style class to access any (CSS) property using the following syntax:
<code>
Style->margin_top = "1em";
echo (Style->margin_top);
</code>

__set() automatically calls the provided set function, if one exists,
otherwise it sets the property directly.  Typically, __set() is not
called directly from outside of this class.

param: string $prop  the property to set
param: mixed  $val   the value of the property

__get($prop)   X-Ref
PHP5 overloaded getter

Along with {@link Style::__set()} __get() provides access to all CSS
properties directly.  Typically __get() is not called directly outside
of this class.

param: string $prop
return: mixed

get_font_family()   X-Ref
Getter for the 'font-family' CSS property.

Uses the {@link Font_Metrics} class to resolve the font family into an
actual font file.

return: string

get_font_size()   X-Ref
Returns the resolved font size, in points

return: float

get_word_spacing()   X-Ref

return: float

get_line_height()   X-Ref

return: float

get_color()   X-Ref
Returns the colour as an array

The array has the following format:
<code>array(r,g,b, "r" => r, "g" => g, "b" => b, "hex" => "#rrggbb")</code>

return: array

get_background_color()   X-Ref
Returns the background colour as an array

The returned array has the same format as {@link Style::get_color()}

return: array

get_background_position()   X-Ref
Returns the background position as an array

The returned array has the following format:
<code>array(x,y, "x" => x, "y" => y)</code>

return: array

get_border_top_color()   X-Ref
No description

get_border_right_color()   X-Ref
No description

get_border_bottom_color()   X-Ref
No description

get_border_left_color()   X-Ref
No description

get_border_top_width()   X-Ref
No description

get_border_right_width()   X-Ref
No description

get_border_bottom_width()   X-Ref
No description

get_border_left_width()   X-Ref
No description

get_border_properties()   X-Ref
Return an array of all border properties.

The returned array has the following structure:
<code>
array("top" => array("width" => [border-width],
"style" => [border-style],
"color" => [border-color (array)]),
"bottom" ... )
</code>

return: array

_get_border($side)   X-Ref
Return a single border property

return: mixed

get_border_top()   X-Ref
No description

get_border_right()   X-Ref
No description

get_border_bottom()   X-Ref
No description

get_border_left()   X-Ref
No description

get_border_spacing()   X-Ref
Returns border spacing as an array

The array has the format (h_space,v_space)

return: array

set_color($colour)   X-Ref
Sets colour

The colour parameter can be any valid CSS colour value

param: string $colour

set_background_color($colour)   X-Ref
Sets the background colour

param: string $colour

set_background_image($val)   X-Ref
Set the background image url

param: string $url

set_font_size($size)   X-Ref
Sets the font size

$size can be any acceptable CSS size

param: string|float $size

set_page_break_before($break)   X-Ref
No description

set_page_break_after($break)   X-Ref
No description

set_margin_top($val)   X-Ref
No description

set_margin_right($val)   X-Ref
No description

set_margin_bottom($val)   X-Ref
No description

set_margin_left($val)   X-Ref
No description

set_margin($val)   X-Ref
No description

set_padding_top($val)   X-Ref
No description

set_padding_right($val)   X-Ref
No description

set_padding_bottom($val)   X-Ref
No description

set_padding_left($val)   X-Ref
No description

set_padding($val)   X-Ref
No description

_set_border($side, $border_spec)   X-Ref
Sets a single border

param: string $side
param: string $border_spec  ([width] [style] [color])

set_border_top($val)   X-Ref
No description

set_border_right($val)   X-Ref
No description

set_border_bottom($val)   X-Ref
No description

set_border_left($val)   X-Ref
No description

set_border($val)   X-Ref
No description

set_border_width($val)   X-Ref
No description

set_border_color($val)   X-Ref
No description

set_border_style($val)   X-Ref
No description

set_border_spacing($val)   X-Ref
Sets the border spacing

param: float $val   

set_list_style_image($val)   X-Ref
Sets the list style image

param: $val

set_list_style($val)   X-Ref
Sets the list style

This is not currently implemented

param: $val

__toString()   X-Ref
Generate a string representation of the Style

This dumps the entire property array into a string via print_r.  Useful
for debugging.

return: string



[ Powered by PHPXref - Served by Debian GNU/Linux ]