5#ifndef JAWSMAKO_LAYOUT_H
6#define JAWSMAKO_LAYOUT_H
72 virtual ILayoutFramePtr
clone()
const = 0;
127 double spacingAfter = 0.0,
double spacingBefore = 0.0,
128 double leading = 1.0,
129 const IDOMColorPtr &defaultColor = IDOMColorPtr(),
130 const ILayoutFontPtr &defaultFont = ILayoutFontPtr(),
132 double defaultFontSize = -1.0);
152 double spacingAfter,
double spacingBefore,
154 const IDOMColorPtr &defaultColor,
155 const IDOMFontOpenTypePtr &defaultFont,
156 uint32 defaultFontIndex = 0,
157 double defaultFontSize = -1.0);
166 virtual ILayoutParagraphPtr
clone()
const = 0;
172 virtual void addRun(
const ILayoutRunPtr &run) = 0;
195 virtual void setSpacing(
double spacing,
bool before =
false) = 0;
231 virtual void setDefaultFont(
const ILayoutFontPtr &defaultFont,
bool exact =
true) = 0;
241 uint32 defaultFontIndex) = 0;
324 const IDOMFontOpenTypePtr &font,
327 const IDOMColorPtr &color = IDOMColorPtr(),
328 double letterSpacing = 0.0);
347 const IDOMFontOpenTypePtr &font,
350 const IDOMColorPtr &color = IDOMColorPtr(),
351 double letterSpacing = 0.0);
373 const ILayoutFontPtr &font,
376 const IDOMColorPtr &color = IDOMColorPtr(),
377 double letterSpacing = 0.0);
399 const ILayoutFontPtr &font,
402 const IDOMColorPtr &color = IDOMColorPtr(),
403 double letterSpacing = 0.0);
426 const IDOMColorPtr &color = IDOMColorPtr(),
427 double letterSpacing = 0.0);
450 const IDOMColorPtr &color = IDOMColorPtr(),
451 double letterSpacing = 0.0);
463 virtual const IDOMFontOpenTypePtr &
getFont()
const = 0;
481 virtual void setColor(
const IDOMColorPtr &color) = 0;
502 #define obj2ILayoutTextRun(obj) ILayoutTextRunPtr(dynamic_cast<ILayoutTextRun *>((IRCObject *) obj), true)
525 static JAWSMAKO_API ILayoutImageRunPtr
create(
const IJawsMakoPtr &jawsMako,
const IDOMImagePtr &image,
double width = 0.0,
double height = 0.0);
545 #define obj2ILayoutImageRun(obj) ILayoutImageRunPtr(dynamic_cast<ILayoutImageRun *>((IRCObject *) obj), true)
631 virtual bool equals(
const ILayoutFontWeightPtr &weight)
const = 0;
633 #define obj2ILayoutFontWeight(obj) ILayoutFontWeightPtr(dynamic_cast<ILayoutFontWeight *>((IRCObject *) obj), true)
699 const ILayoutFontWeightPtr &weight = ILayoutFontWeightPtr(),
703 uint64 codePage = UINT64_MAX);
710 virtual void setWeight(
const ILayoutFontWeightPtr &weight) = 0;
769 return ! (*
this == other);
800 virtual void findFont(IDOMFontOpenTypePtr &font,
uint32 &fontIndex,
bool exact =
true)
const = 0;
802 #define obj2ILayoutFont(obj) ILayoutFontPtr(dynamic_cast<ILayoutFont *>((IRCObject *) obj), true)
835 const FRect &frameBounds,
844 virtual void addFrame(
const ILayoutFramePtr &frame) = 0;
862 virtual IDOMNodePtr
layout(
const ILayoutParagraphPtr ¶graph) = 0;
877 virtual IDOMNodePtr
layout(
const ILayoutRunPtr &run,
879 double spacingAfter = 0.0,
880 double spacingBefore = 0.0,
881 double leading = 1.0) = 0;
Definition edlvector.h:30
Base class Interface for all Reference Counted objects.
Definition ircobject.h:35
bool operator==(const CLayoutFontItem &other) const
Definition layout.h:761
CLayoutFontItem()
Definition layout.h:756
IDOMFontOpenTypePtr domFont
Definition layout.h:747
bool operator!=(const CLayoutFontItem &other) const
Definition layout.h:767
bool operator<(const CLayoutFontItem &other) const
Definition layout.h:772
CLayoutFontItem(const IDOMFontOpenTypePtr &domFont, uint32 fontIndex)
Definition layout.h:750
uint32 fontIndex
Definition layout.h:748
ILayoutFont interface.
Definition layout.h:644
virtual ~ILayoutFont()
Definition layout.h:646
virtual void findFont(IDOMFontOpenTypePtr &font, uint32 &fontIndex, bool exact=true) const =0
Find matching font.
virtual CLayoutFontVect findFonts() const =0
Find matching fonts.
virtual void setCodePage(uint64 codePage)=0
virtual void setWeight(const ILayoutFontWeightPtr &weight)=0
CEDLVector< CLayoutFontItem > CLayoutFontVect
Definition layout.h:782
eFontSerifStyle
Font serif style.
Definition layout.h:672
@ eFSSSansSerif
Sans Serif.
Definition layout.h:675
@ eFSSSerif
Serif.
Definition layout.h:674
@ eFSSAny
Match against any style.
Definition layout.h:673
static JAWSMAKO_API ILayoutFontPtr create(const IJawsMakoPtr &jawsMako, const ILayoutFontWeightPtr &weight=ILayoutFontWeightPtr(), eFontStyle style=eFSAny, eFontProportion proportion=eFPAny, eFontSerifStyle serifStyle=eFSSAny, uint64 codePage=UINT64_MAX)
Create a ILayoutFont instance.
virtual void setSerif(eFontSerifStyle serifStyle)=0
eFontStyle
Font style.
Definition layout.h:652
@ eFSItalic
Italic.
Definition layout.h:654
@ eFSRegular
Regular.
Definition layout.h:655
@ eFSAny
Match against any style.
Definition layout.h:653
eFontProportion
Font proportion.
Definition layout.h:662
@ eFPAny
Match against any proportion type.
Definition layout.h:663
@ eFPMonoSpaced
Monospace (fixed-width) font.
Definition layout.h:664
@ eFPProportional
Proportional (variable-width) font.
Definition layout.h:665
virtual void setProportion(eFontProportion proportion)=0
virtual void setStyle(eFontStyle style)=0
Font weights used by ILayoutFont for font selection.
Definition layout.h:553
virtual bool equals(const ILayoutFontWeightPtr &weight) const =0
Determines if the given weight instance is equivalent to this instance.
static JAWSMAKO_API ILayoutFontWeightPtr createFromVect(const CUInt16Vect &weights, uint16 allowedError=0)
Create a font weight instance using a vector of weight values.
virtual bool match(uint16 weight) const =0
Test for a matching font weight.
eFontWeight
Font weight.
Definition layout.h:563
@ eExtraBold
Extra Bold.
Definition layout.h:573
@ eBlack
Black.
Definition layout.h:574
@ eThin
Thin.
Definition layout.h:565
@ eAny
Match against any weight.
Definition layout.h:564
@ eLight
Light.
Definition layout.h:567
@ eSemiBold
Semi Bold.
Definition layout.h:571
@ eMedium
Medium.
Definition layout.h:570
@ eExtraBlack
Extra Black.
Definition layout.h:575
@ eNormal
Normal.
Definition layout.h:569
@ eSemiLight
Semi Light.
Definition layout.h:568
@ eBold
Bold.
Definition layout.h:572
@ eExtraLight
Extra Light.
Definition layout.h:566
virtual uint16 difference(uint16 weight) const =0
Find the font weight difference.
static JAWSMAKO_API ILayoutFontWeightPtr createFromRange(uint16 weightLow, uint16 weightHigh)
Create a font weight instance using a range of weight values.
virtual ~ILayoutFontWeight()
Definition layout.h:555
static JAWSMAKO_API ILayoutFontWeightPtr create(uint16 weight=eAny, uint16 allowedError=0)
Create a font weight instance using a single weight value.
virtual const FRect & getBounds() const =0
Get the bounds of this frame.
eVerticalAlignment
Vertical alignment for this frame.
Definition layout.h:52
@ eVABottom
Align vertically to the bottom of the frame.
Definition layout.h:55
@ eVATop
Align vertically to the top of the frame.
Definition layout.h:53
@ eVACenter
Align vertically centered.
Definition layout.h:54
static JAWSMAKO_API ILayoutFramePtr create(const FRect &bounds, eVerticalAlignment verticalAlignment=eVATop)
Create a frame.
virtual ~ILayoutFrame()
Definition layout.h:46
virtual ILayoutFramePtr clone() const =0
Clone the frame.
virtual eVerticalAlignment getVerticalAlignment() const =0
Get the vertical alignment of the content of this frame.
An instance of a Layout engine that can layout and flow text into one or more frames,...
Definition layout.h:812
virtual ~ILayout()
Definition layout.h:814
static JAWSMAKO_API ILayoutPtr createWithFrame(const IJawsMakoPtr &jawsMako, const FRect &frameBounds, ILayoutFrame::eVerticalAlignment frameVerticalAlignment=ILayoutFrame::eVACenter)
Create an instance of the layout engine with a frame.
virtual IDOMNodePtr layout(const ILayoutRunPtr &run, ILayoutParagraph::eHorizontalAlignment horizontalAlignment, double spacingAfter=0.0, double spacingBefore=0.0, double leading=1.0)=0
Lay out a run of content.
virtual void addFrame(const ILayoutFramePtr &frame)=0
Add a frame to the list of frames into which the engine will flow content. Content will be laid out i...
virtual IDOMNodePtr layout(const ILayoutParagraphPtr ¶graph)=0
Lay out a single paragraph.
static JAWSMAKO_API ILayoutPtr create(const IJawsMakoPtr &jawsMako)
Create an instance of the layout engine.
virtual IDOMNodePtr layout(const CLayoutParagraphVect ¶graphs)=0
Lay out the given paragraphs into the frames, returning a DOM representation of the result.
A run of image content to be added to an ILayoutParagraph.
Definition layout.h:510
virtual double getWidth() const =0
Get the width of the image.
virtual const IDOMImagePtr & getImage() const =0
Get the image.
virtual ~ILayoutImageRun()
Definition layout.h:512
static JAWSMAKO_API ILayoutImageRunPtr create(const IJawsMakoPtr &jawsMako, const IDOMImagePtr &image, double width=0.0, double height=0.0)
Create an image run.
virtual double getHeight() const =0
Get the height of the image.
A paragraph, consisting of a number of runs of content.
Definition layout.h:93
virtual void setDefaultFont(const ILayoutFontPtr &defaultFont, bool exact=true)=0
Set an ILayoutFont instance to select a default font for the the paragraph, or nullptr to clear the d...
virtual const CLayoutRunVect & getRuns() const =0
Get the runs present in this paragraph.
virtual uint32 getDefaultFontIndex() const =0
Get the font index within the default font file.
virtual void setDefaultFont(const IDOMFontOpenTypePtr &defaultFont, uint32 defaultFontIndex)=0
Set an the default font for the paragraph, or nullptr to clear the default.
virtual double getSpacing(bool before=false) const =0
Get the paragraph spacing.
virtual const IDOMFontOpenTypePtr & getDefaultFont() const =0
Get the default font for the paragraph.
virtual double getLeading() const =0
Get the leading (line spacing).
static JAWSMAKO_API ILayoutParagraphPtr create(eHorizontalAlignment horizontalAlignment=eHALeft, double spacingAfter=0.0, double spacingBefore=0.0, double leading=1.0, const IDOMColorPtr &defaultColor=IDOMColorPtr(), const ILayoutFontPtr &defaultFont=ILayoutFontPtr(), bool exact=true, double defaultFontSize=-1.0)
Create a paragraph.
virtual eHorizontalAlignment getHorizontalAlignment() const =0
Get the horizontal alignment for this paragraph.
virtual const IDOMColorPtr & getDefaultColor() const =0
Get the default color for the paragraph.
virtual void setLeading(double leading)=0
Set the leading (line spacing).
virtual ~ILayoutParagraph()
Definition layout.h:95
virtual void addRun(const ILayoutRunPtr &run)=0
Add a run to the end of the paragraph.
eHorizontalAlignment
Horizontal alignment or justification for the paragraph.
Definition layout.h:101
@ eHACenter
Align the content to the center of the enclosing frame.
Definition layout.h:103
@ eHAJustified
Justify the content left and right.
Definition layout.h:105
@ eHARight
Align the content to the right boundary of the enclosing frame.
Definition layout.h:104
@ eHALeft
Align the content to the left boundary of the enclosing frame.
Definition layout.h:102
virtual ILayoutParagraphPtr clone() const =0
Clone the paragraph.
static JAWSMAKO_API ILayoutParagraphPtr create(eHorizontalAlignment horizontalAlignment, double spacingAfter, double spacingBefore, double leading, const IDOMColorPtr &defaultColor, const IDOMFontOpenTypePtr &defaultFont, uint32 defaultFontIndex=0, double defaultFontSize=-1.0)
Create a paragraph.
virtual double getDefaultFontSize() const =0
Get the default font size on DOM units.
virtual void setDefaultFontSize(double defaultFontSize)=0
Set the default font size of the paragraph.
virtual void addBreak()=0
Add a break to the end of the paragraph.
virtual void setSpacing(double spacing, bool before=false)=0
Set the paragraph spacing.
virtual void setDefaultColor(const IDOMColorPtr &defaultColor)=0
Set a default color for the paragraph, or nullptr to clear the default.
A run of content to be added to an ILayoutParagraph.
Definition layout.h:295
virtual ~ILayoutRun()
Definition layout.h:297
A run of text content to be added to an ILayoutParagraph.
Definition layout.h:306
virtual const IDOMColorPtr & getColor() const =0
Get the text color.
virtual double getSize() const =0
Get the em size of the font in default DOM units (96ths of an inch)
virtual const IDOMFontOpenTypePtr & getFont() const =0
Get the font.
virtual uint32 getFontIndex() const =0
Get the font index within the font file.
virtual double getLetterSpacing() const =0
Get the letter spacing.
static JAWSMAKO_API ILayoutTextRunPtr create(const IJawsMakoPtr &jawsMako, const U8String &text, const U8String &fontName, double size, const IDOMColorPtr &color=IDOMColorPtr(), double letterSpacing=0.0)
Create a text run.
static JAWSMAKO_API ILayoutTextRunPtr create(const String &text, const IDOMFontOpenTypePtr &font, uint32 fontIndex, double size, const IDOMColorPtr &color=IDOMColorPtr(), double letterSpacing=0.0)
Create a text run.
virtual void setColor(const IDOMColorPtr &color)=0
Set the text color.
static JAWSMAKO_API ILayoutTextRunPtr create(const U8String &text, const IDOMFontOpenTypePtr &font, uint32 fontIndex, double size, const IDOMColorPtr &color=IDOMColorPtr(), double letterSpacing=0.0)
Create a text run.
virtual const U8String & getText() const =0
Get the text in the run as UTF-8.
static JAWSMAKO_API ILayoutTextRunPtr create(const U8String &text, const ILayoutFontPtr &font, double size, bool exact=true, const IDOMColorPtr &color=IDOMColorPtr(), double letterSpacing=0.0)
Create a text run.
virtual void setLetterSpacing(double letterSpacing)=0
Set the letter spacing.
static JAWSMAKO_API ILayoutTextRunPtr create(const IJawsMakoPtr &jawsMako, const String &text, const U8String &fontName, double size, const IDOMColorPtr &color=IDOMColorPtr(), double letterSpacing=0.0)
Create a text run.
virtual ~ILayoutTextRun()
Definition layout.h:308
static JAWSMAKO_API ILayoutTextRunPtr create(const String &text, const ILayoutFontPtr &font, double size, bool exact=true, const IDOMColorPtr &color=IDOMColorPtr(), double letterSpacing=0.0)
Create a text run.
RectTmpl< double > FRect
Definition edlgeom.h:338
unsigned short uint16
Definition edltypes.h:33
unsigned int uint32
Definition edltypes.h:34
unsigned long long uint64
Definition edltypes.h:35
EDLSysString U8String
A UTF-8 String.
Definition types.h:144
EDLString String
A wide character string (UTF-16 on Windows, UTF-32 on all other platforms)
Definition types.h:138
Definition apexcustompostprocess.h:17
CEDLVector< uint16 > CUInt16Vect
Definition types.h:179
CEDLVector< ILayoutParagraphPtr > CLayoutParagraphVect
Definition layout.h:25
CEDLVector< ILayoutRunPtr > CLayoutRunVect
Definition layout.h:32
#define DECL_SMART_PTR(cls)
Definition smartptr.h:211
#define JAWSMAKO_API
Definition types.h:29