5namespace Stroika::Frameworks::Led {
12 inline StyleRunElement::StyleRunElement (StyleMarker* marker,
size_t length)
23#if qStroika_Frameworks_Led_SupportGDI
24 template <
class BASECLASS>
25 FontSpecification SimpleStyleMarkerByFontSpec<BASECLASS>::MakeFontSpec (
const StyledTextImager* imager,
const StyleRunElement& )
const
28 return imager->GetDefaultFont ();
30 template <
class BASECLASS>
31 void SimpleStyleMarkerByFontSpec<BASECLASS>::DrawSegment (
const StyledTextImager* imager,
const StyleRunElement& runElement, Tablet* tablet,
32 size_t from,
size_t to,
const TextLayoutBlock& text,
const Led_Rect& drawInto,
33 const Led_Rect& , CoordinateType useBaseLine, DistanceType* pixelsDrawn)
36 imager->DrawSegment_ (tablet, MakeFontSpec (imager, runElement), from, to, text, drawInto, useBaseLine, pixelsDrawn);
38 template <
class BASECLASS>
39 void SimpleStyleMarkerByFontSpec<BASECLASS>::MeasureSegmentWidth (
const StyledTextImager* imager,
const StyleRunElement& runElement,
size_t from,
40 size_t to,
const Led_tChar* text, DistanceType* distanceResults)
const
43 imager->MeasureSegmentWidth_ (this->MakeFontSpec (imager, runElement), from, to, text, distanceResults);
45 template <
class BASECLASS>
46 DistanceType SimpleStyleMarkerByFontSpec<BASECLASS>::MeasureSegmentHeight (
const StyledTextImager* imager,
47 const StyleRunElement& runElement,
size_t from,
size_t to)
const
50 return (imager->MeasureSegmentHeight_ (this->MakeFontSpec (imager, runElement), from, to));
52 template <
class BASECLASS>
53 DistanceType SimpleStyleMarkerByFontSpec<BASECLASS>::MeasureSegmentBaseLine (
const StyledTextImager* imager,
54 const StyleRunElement& runElement,
size_t from,
size_t to)
const
57 return (imager->MeasureSegmentBaseLine_ (this->MakeFontSpec (imager, runElement), from, to));
66 template <
class BASECLASS>
67 inline SimpleStyleMarkerByIncrementalFontSpec<BASECLASS>::SimpleStyleMarkerByIncrementalFontSpec (
const IncrementalFontSpecification& styleInfo)
68 : fFontSpecification{styleInfo}
71#if qStroika_Frameworks_Led_SupportGDI
72 template <
class BASECLASS>
73 FontSpecification SimpleStyleMarkerByIncrementalFontSpec<BASECLASS>::MakeFontSpec (
const StyledTextImager* imager,
const StyleRunElement& runElement)
const
76 FontSpecification fsp = inherited::MakeFontSpec (imager, runElement);
77 fsp.MergeIn (fFontSpecification);
87 inline TrivialFontSpecStyleMarker::TrivialFontSpecStyleMarker (
const IncrementalFontSpecification& styleInfo)
88 : inherited{styleInfo}
97 template <
class BASECLASS>
98 StyleRunElement SimpleStyleMarkerWithExtraDraw<BASECLASS>::MungeRunElement (
const StyleRunElement& inRunElt)
const
100 StyleRunElement newRunElement = inRunElt;
101 Require (inRunElt.fMarker == (StyleMarker*)
this);
102 newRunElement.fMarker =
nullptr;
103 for (
auto i = newRunElement.fSupercededMarkers.begin (); i != newRunElement.fSupercededMarkers.end ();) {
104 if (newRunElement.fMarker ==
nullptr or newRunElement.fMarker->GetPriority () < (*i)->GetPriority ()) {
105 newRunElement.fMarker = (*i);
106 i = newRunElement.fSupercededMarkers.erase (i);
112 return newRunElement;
114#if qStroika_Frameworks_Led_SupportGDI
115 template <
class BASECLASS>
116 void SimpleStyleMarkerWithExtraDraw<BASECLASS>::DrawSegment (
const StyledTextImager* imager,
const StyleRunElement& runElement, Tablet* tablet,
117 size_t from,
size_t to,
const TextLayoutBlock& text,
const Led_Rect& drawInto,
118 const Led_Rect& invalidRect, CoordinateType useBaseLine, DistanceType* pixelsDrawn)
123 StyleRunElement re = MungeRunElement (runElement);
124 if (re.fMarker ==
nullptr) {
125 imager->DrawSegment_ (tablet, this->MakeFontSpec (imager, re), from, to, text, drawInto, useBaseLine, pixelsDrawn);
128 re.fMarker->DrawSegment (imager, re, tablet, from, to, text, drawInto, invalidRect, useBaseLine, pixelsDrawn);
130 DrawExtra (imager, re, tablet, from, to, text, drawInto, useBaseLine, *pixelsDrawn);
132 template <
class BASECLASS>
133 void SimpleStyleMarkerWithExtraDraw<BASECLASS>::MeasureSegmentWidth (
const StyledTextImager* imager,
const StyleRunElement& runElement,
size_t from,
134 size_t to,
const Led_tChar* text, DistanceType* distanceResults)
const
137 StyleRunElement re = MungeRunElement (runElement);
138 if (re.fMarker ==
nullptr) {
139 imager->MeasureSegmentWidth_ (this->MakeFontSpec (imager, re), from, to, text, distanceResults);
142 re.fMarker->MeasureSegmentWidth (imager, re, from, to, text, distanceResults);
145 template <
class BASECLASS>
146 DistanceType SimpleStyleMarkerWithExtraDraw<BASECLASS>::MeasureSegmentHeight (
const StyledTextImager* imager,
147 const StyleRunElement& runElement,
size_t from,
size_t to)
const
150 StyleRunElement re = MungeRunElement (runElement);
151 if (re.fMarker ==
nullptr) {
152 return (imager->MeasureSegmentHeight_ (this->MakeFontSpec (imager, re), from, to));
155 return (re.fMarker->MeasureSegmentHeight (imager, re, from, to));
158 template <
class BASECLASS>
159 DistanceType SimpleStyleMarkerWithExtraDraw<BASECLASS>::MeasureSegmentBaseLine (
const StyledTextImager* imager,
160 const StyleRunElement& runElement,
size_t from,
size_t to)
const
163 StyleRunElement re = MungeRunElement (runElement);
164 if (re.fMarker ==
nullptr) {
165 return (imager->MeasureSegmentBaseLine_ (this->MakeFontSpec (imager, re), from, to));
168 return (re.fMarker->MeasureSegmentBaseLine (imager, re, from, to));
178#if qStroika_Frameworks_Led_SupportGDI
179 template <
typename BASECLASS>
180 void SimpleStyleMarkerWithLightUnderline<BASECLASS>::DrawExtra (
const StyledTextImager* ,
const StyleRunElement& ,
181 Tablet* tablet,
size_t ,
size_t ,
const TextLayoutBlock& ,
182 const Led_Rect& drawInto, CoordinateType useBaseLine, DistanceType pixelsDrawn)
184 Color lightColor = Color::kWhite / 2 + GetUnderlineBaseColor () / 2;
185#if qStroika_Foundation_Common_Platform_Windows
186 Pen pen (PS_DOT, 1, lightColor.GetOSRep ());
187#elif qStroika_Foundation_Common_Platform_MacOS
188 Pen pen (patCopy, &Pen::kGrayPattern, lightColor);
189#elif qStroika_FeatureSupported_XWindows
192 GDI_Obj_Selector penWrapper (tablet, pen);
193 CoordinateType underlineAt = useBaseLine;
194 if (underlineAt + 1 < drawInto.bottom) {
197 tablet->MoveTo (Led_Point (underlineAt, drawInto.left));
198 tablet->LineTo (Led_Point (underlineAt, drawInto.left + pixelsDrawn));
201 template <
typename BASECLASS>
202 inline Color SimpleStyleMarkerWithLightUnderline<BASECLASS>::GetUnderlineBaseColor ()
const
204 return Color::kBlack;
207#if qStroika_Frameworks_Led_SupportGDI
213 inline void StyledTextImager::Invariant ()
const
215#if qStroika_Foundation_Debug_AssertionsChecked and qStroika_Frameworks_Led_HeavyDebugging
#define RequireNotNull(p)