#include <Mapper.hpp>
Inheritance diagram for HTML::Renderer::RequiredRendererImplementation:
The mapper calls method from this interface to get rendered size of elements, font used, and all graphical stuff. An application must implement this callback in order to use the mapper
Public Member Functions | |
virtual CSS::Font * | getBolderFont (CSS::Font *font)=0 |
Get a bolder font than the given font. | |
virtual CSS::Font * | getColouredFont (CSS::Font *font, const CSS::Colour &color)=0 |
Get a coloured font than the given font. | |
virtual CSS::Font * | getDefaultFont ()=0 |
Get the default font object to use for the renderer. | |
virtual CSS::Font * | getItalicFont (CSS::Font *font)=0 |
Get an italic font derived from the given font. | |
virtual TableLayout * | getKnownTableLayout (const BoxHierarchy *box)=0 |
Get an existing table layout from its BoxHierarchy key. | |
virtual bool | getMinAndMaxWidthOf (Box *box, int32 &minimumWidth, int32 &maximumWidth)=0 |
Get the minimum and maximum width of the given box, in order to compute table real size. | |
virtual uint32 | getMinimumHeightOf (Box *box)=0 |
Get the minimum height of the given element. | |
virtual uint32 | getMinimumWidthOf (Box *box)=0 |
Get the minimum width of the given element. | |
virtual CSS::Font * | getMonospaceFont (CSS::Font *font)=0 |
Get a monospace font derived from the given font. | |
virtual TableLayout * | getNewTableLayout (const BoxHierarchy *box)=0 |
Get a new table layout object so the renderer can save the layout it finds in it. | |
virtual uint32 | getRenderedHeightOf (Box *box)=0 |
Get the rendering height of the given element. | |
virtual uint32 | getRenderedWidthOf (Box *box)=0 |
Get the rendering width of the given element. | |
virtual CSS::Font * | getScaledFont (CSS::Font *font, const float scale)=0 |
Get a scaled font than the given font. | |
virtual bool | getSplitLimitsOf (Box *box, const int32 boxLeft, const int32 boxRight, const int32 top, const int32 left, int32 &right, int32 &bottom)=0 |
Get the split limits of the given inline box. |
virtual CSS::Font* HTML::Renderer::RequiredRendererImplementation::getBolderFont | ( | CSS::Font * | font | ) | [pure virtual] |
Get a bolder font than the given font.
font | The reference font to get an heavier stroke from |
Implemented in juce::BrowserContent.
virtual CSS::Font* HTML::Renderer::RequiredRendererImplementation::getColouredFont | ( | CSS::Font * | font, | |
const CSS::Colour & | color | |||
) | [pure virtual] |
Get a coloured font than the given font.
font | The reference font to scale from | |
color | The new font color |
Implemented in juce::BrowserContent.
virtual CSS::Font* HTML::Renderer::RequiredRendererImplementation::getDefaultFont | ( | ) | [pure virtual] |
Get the default font object to use for the renderer.
Implemented in juce::BrowserContent.
virtual CSS::Font* HTML::Renderer::RequiredRendererImplementation::getItalicFont | ( | CSS::Font * | font | ) | [pure virtual] |
Get an italic font derived from the given font.
font | The reference font to get an inclined stroke from |
Implemented in juce::BrowserContent.
virtual TableLayout* HTML::Renderer::RequiredRendererImplementation::getKnownTableLayout | ( | const BoxHierarchy * | box | ) | [pure virtual] |
Get an existing table layout from its BoxHierarchy key.
This method is called when the box hierarchy is mapped to individual rendering boxes.
box | The box object which is used as a key in the table layout array |
Implemented in juce::BrowserContent.
virtual bool HTML::Renderer::RequiredRendererImplementation::getMinAndMaxWidthOf | ( | Box * | box, | |
int32 & | minimumWidth, | |||
int32 & | maximumWidth | |||
) | [pure virtual] |
Get the minimum and maximum width of the given box, in order to compute table real size.
The minimum width is not like the other method which tries to determine the required size in the box rendering algorithm. In this case, the minimum width is the mathematical minimum width of all individual items in this box.
For example, a box that contains "A small text that may contain such <PICTURE>", will be cut in parts:
The maximum width is computed like if the rendering area was unlimited. They are no line break to take into account, but
are still valid. The biggest line will make the maximum width.
In the previous example, it's the width of "A small text that may contain such <PICTURE>" that should be stored in maximum width.
Then, both minimum and maximum width will be stored in the given table layout by the mapper at the right place.
It's mapper's responsibility to iterate over every box in every cell of the table. The renderer simply returns the widths as required.
box | The box that need to be measured and/or split | |
minimunWidth | A reference on the minimum width variable to store result into | |
maximumWidth | A reference on the maximum width variable to store result into |
Implemented in juce::BrowserContent.
virtual uint32 HTML::Renderer::RequiredRendererImplementation::getMinimumHeightOf | ( | Box * | box | ) | [pure virtual] |
Get the minimum height of the given element.
box | The box to get the minimum rendered content height |
Implemented in juce::BrowserContent.
virtual uint32 HTML::Renderer::RequiredRendererImplementation::getMinimumWidthOf | ( | Box * | box | ) | [pure virtual] |
Get the minimum width of the given element.
box | The box to get the minimum rendered content width |
Implemented in juce::BrowserContent.
virtual CSS::Font* HTML::Renderer::RequiredRendererImplementation::getMonospaceFont | ( | CSS::Font * | font | ) | [pure virtual] |
Get a monospace font derived from the given font.
font | The reference font to get an monospaced stroke from |
Implemented in juce::BrowserContent.
virtual TableLayout* HTML::Renderer::RequiredRendererImplementation::getNewTableLayout | ( | const BoxHierarchy * | box | ) | [pure virtual] |
Get a new table layout object so the renderer can save the layout it finds in it.
Currently, the DOM tree is entirely parsed. This means that we can render a table correctly, as we have access to every cell content of the table. The table layout is created by the mapper, and 2 rendering passes are applied on the the cells. The first rendering pass determines the table layout (number of rows & columns), and the minimum cell size for each cells (using CSS rendering model) The table width is then adjusted and column size are computed exactly. The last rendering pass set the column size, row & cell positions and break the cell content if required.
The mapper performs the first part of the first pass when it generates the box hierarchy. Then, when it maps the box hierarchy to individuals boxes it call the getStoredTableLayout callback to add the final part of the first pass and then add the second pass.
The table layout is cell size-independent, so it can/will be reused when the rendering viewport is updated.
box | The box object which is used as a key in the table layout array |
Implemented in juce::BrowserContent.
virtual uint32 HTML::Renderer::RequiredRendererImplementation::getRenderedHeightOf | ( | Box * | box | ) | [pure virtual] |
Get the rendering height of the given element.
box | The box to get the rendered content width |
Implemented in juce::BrowserContent.
virtual uint32 HTML::Renderer::RequiredRendererImplementation::getRenderedWidthOf | ( | Box * | box | ) | [pure virtual] |
Get the rendering width of the given element.
box | The box to get the rendered content width |
Implemented in juce::BrowserContent.
virtual CSS::Font* HTML::Renderer::RequiredRendererImplementation::getScaledFont | ( | CSS::Font * | font, | |
const float | scale | |||
) | [pure virtual] |
Get a scaled font than the given font.
font | The reference font to scale from | |
scale | The scale factor |
Implemented in juce::BrowserContent.
virtual bool HTML::Renderer::RequiredRendererImplementation::getSplitLimitsOf | ( | Box * | box, | |
const int32 | boxLeft, | |||
const int32 | boxRight, | |||
const int32 | top, | |||
const int32 | left, | |||
int32 & | right, | |||
int32 & | bottom | |||
) | [pure virtual] |
Get the split limits of the given inline box.
Typical renderer will find where to split the box's text (can be split multiple time if required) and then extract the right and bottom position of the last text's character from the top and left position of the first. The renderer will then modify the right and bottom parameters to reflect the last part.
// Let's say we want to render "My big house is marvelous in summer and wonderful in winter." // so that only 20 chars can fit on a line // The renderer will probably render : // // \/ BoxLeft \/ Top Left // previous line. My // big house is // marvelous in |< BoxRight // summer and // wonderful in // winter. // /\ Bottom right // For example, on input top = 2, left = 15, boxLeft = 0, boxRight = 20 getSplitLimitsOf(box, boxLeft, boxRight, top, left, right, bottom); // Method should return in previous example : right = 7, bottom = 7 // BTW, the example assume 1 char = 1 px * 1px which is obviously wrong
box | The box to get the render and split the content text | |
boxLeft | The container's box left content position (so that when splitting occur, bottom line's left border will match boxLeft position) | |
boxRight | The container's box right content position (so that splitting occur when any text render on the right of this position) | |
top | The top position of the first char of text | |
left | The left position of the first char of text | |
right | The right position of the last line's char should be saved here | |
bottom | The bottom position of the last line's char should be saved here |
Implemented in juce::BrowserContent.