LibreOffice Module sw (master) 1
swfont.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <hintids.hxx>
21
22#include <com/sun/star/i18n/ScriptType.hpp>
23#include <vcl/outdev.hxx>
24#include <editeng/brushitem.hxx>
25#include <editeng/wrlmitem.hxx>
26#include <editeng/kernitem.hxx>
27#include <editeng/cmapitem.hxx>
28#include <editeng/langitem.hxx>
31#include <editeng/shdditem.hxx>
34#include <editeng/colritem.hxx>
36#include <editeng/udlnitem.hxx>
37#include <editeng/wghtitem.hxx>
38#include <editeng/postitem.hxx>
39#include <editeng/fhgtitem.hxx>
40#include <editeng/fontitem.hxx>
46#include <editeng/boxitem.hxx>
47#include <editeng/shaditem.hxx>
49#include <charatr.hxx>
50#include <viewsh.hxx>
51#include <swfont.hxx>
52#include <fntcache.hxx>
53#include <txtfrm.hxx>
54#include <scriptinfo.hxx>
55
56#ifdef DBG_UTIL
57// global Variable
59#endif
60
61using namespace ::com::sun::star;
62
63// set background brush, depending on character formatting
64void SwFont::SetBackColor( std::optional<Color> xNewColor )
65{
66 mxBackColor = xNewColor;
67 m_bFontChg = true;
68 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
69}
70
72{
73 if( pTopBorder )
74 m_aTopBorder = *pTopBorder;
75 else
76 {
77 m_aTopBorder.reset();
79 }
80 m_bFontChg = true;
81 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
82}
83
85{
86 if( pBottomBorder )
87 m_aBottomBorder = *pBottomBorder;
88 else
89 {
90 m_aBottomBorder.reset();
92 }
93 m_bFontChg = true;
94 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
95}
96
98{
99 if( pRightBorder )
100 m_aRightBorder = *pRightBorder;
101 else
102 {
103 m_aRightBorder.reset();
105 }
106 m_bFontChg = true;
107 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
108}
109
111{
112 if( pLeftBorder )
113 m_aLeftBorder = *pLeftBorder;
114 else
115 {
116 m_aLeftBorder.reset();
118 }
119 m_bFontChg = true;
120 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
121}
122
123const std::optional<editeng::SvxBorderLine>&
124SwFont::GetAbsTopBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
125{
126 switch (GetOrientation(bVertLayout, bVertLayoutLRBT).get())
127 {
128 case 0 :
129 return m_aTopBorder;
130 case 900 :
131 return m_aRightBorder;
132 case 1800 :
133 return m_aBottomBorder;
134 case 2700 :
135 return m_aLeftBorder;
136 default :
137 assert(false);
138 return m_aTopBorder;
139 }
140}
141
142const std::optional<editeng::SvxBorderLine>&
143SwFont::GetAbsBottomBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
144{
145 switch (GetOrientation(bVertLayout, bVertLayoutLRBT).get())
146 {
147 case 0 :
148 return m_aBottomBorder;
149 case 900 :
150 return m_aLeftBorder;
151 case 1800 :
152 return m_aTopBorder;
153 case 2700 :
154 return m_aRightBorder;
155 default :
156 assert(false);
157 return m_aBottomBorder;
158 }
159}
160
161const std::optional<editeng::SvxBorderLine>&
162SwFont::GetAbsLeftBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
163{
164 switch (GetOrientation(bVertLayout, bVertLayoutLRBT).get())
165 {
166 case 0 :
167 return m_aLeftBorder;
168 case 900 :
169 return m_aTopBorder;
170 case 1800 :
171 return m_aRightBorder;
172 case 2700 :
173 return m_aBottomBorder;
174 default :
175 assert(false);
176 return m_aLeftBorder;
177 }
178}
179
180const std::optional<editeng::SvxBorderLine>&
181SwFont::GetAbsRightBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
182{
183 switch (GetOrientation(bVertLayout, bVertLayoutLRBT).get())
184 {
185 case 0 :
186 return m_aRightBorder;
187 case 900 :
188 return m_aBottomBorder;
189 case 1800 :
190 return m_aLeftBorder;
191 case 2700 :
192 return m_aTopBorder;
193 default :
194 assert(false);
195 return m_aRightBorder;
196 }
197}
198
200 const bool bVertLayoutLRBT) const
201{
202 SvxShadowLocation aLocation = SvxShadowLocation::NONE;
203 switch (GetOrientation(bVertLayout, bVertLayoutLRBT).get())
204 {
205 case 0:
206 aLocation = m_aShadowLocation;
207 break;
208
209 case 900:
210 switch ( m_aShadowLocation )
211 {
212 case SvxShadowLocation::TopLeft:
213 aLocation = SvxShadowLocation::BottomLeft;
214 break;
215 case SvxShadowLocation::TopRight:
216 aLocation = SvxShadowLocation::TopLeft;
217 break;
218 case SvxShadowLocation::BottomLeft:
219 aLocation = SvxShadowLocation::BottomRight;
220 break;
221 case SvxShadowLocation::BottomRight:
222 aLocation = SvxShadowLocation::TopRight;
223 break;
224 case SvxShadowLocation::NONE:
225 case SvxShadowLocation::End:
226 aLocation = m_aShadowLocation;
227 break;
228 }
229 break;
230
231 case 1800:
232 switch ( m_aShadowLocation )
233 {
234 case SvxShadowLocation::TopLeft:
235 aLocation = SvxShadowLocation::BottomRight;
236 break;
237 case SvxShadowLocation::TopRight:
238 aLocation = SvxShadowLocation::BottomLeft;
239 break;
240 case SvxShadowLocation::BottomLeft:
241 aLocation = SvxShadowLocation::TopRight;
242 break;
243 case SvxShadowLocation::BottomRight:
244 aLocation = SvxShadowLocation::TopLeft;
245 break;
246 case SvxShadowLocation::NONE:
247 case SvxShadowLocation::End:
248 aLocation = m_aShadowLocation;
249 break;
250 }
251 break;
252
253 case 2700:
254 switch ( m_aShadowLocation )
255 {
256 case SvxShadowLocation::TopLeft:
257 aLocation = SvxShadowLocation::TopRight;
258 break;
259 case SvxShadowLocation::TopRight:
260 aLocation = SvxShadowLocation::BottomRight;
261 break;
262 case SvxShadowLocation::BottomLeft:
263 aLocation = SvxShadowLocation::TopLeft;
264 break;
265 case SvxShadowLocation::BottomRight:
266 aLocation = SvxShadowLocation::BottomLeft;
267 break;
268 case SvxShadowLocation::NONE:
269 case SvxShadowLocation::End:
270 aLocation = m_aShadowLocation;
271 break;
272 }
273 break;
274
275 default:
276 assert(false);
277 break;
278 }
279 return aLocation;
280}
281
282sal_uInt16 SwFont::CalcShadowSpace(const SvxShadowItemSide nShadow, const bool bVertLayout,
283 const bool bVertLayoutLRBT, const bool bSkipLeft,
284 const bool bSkipRight) const
285{
286 sal_uInt16 nSpace = 0;
287 const Degree10 nOrient = GetOrientation(bVertLayout, bVertLayoutLRBT);
288 const SvxShadowLocation aLoc = GetAbsShadowLocation(bVertLayout, bVertLayoutLRBT);
289 switch( nShadow )
290 {
291 case SvxShadowItemSide::TOP:
292 if(( aLoc == SvxShadowLocation::TopLeft ||
293 aLoc == SvxShadowLocation::TopRight ) &&
294 ( nOrient == 0_deg10 || nOrient == 1800_deg10 ||
295 ( nOrient == 900_deg10 && !bSkipRight ) ||
296 ( nOrient == 2700_deg10 && !bSkipLeft )))
297 {
298 nSpace = m_nShadowWidth;
299 }
300 break;
301
302 case SvxShadowItemSide::BOTTOM:
303 if(( aLoc == SvxShadowLocation::BottomLeft ||
304 aLoc == SvxShadowLocation::BottomRight ) &&
305 ( nOrient == 0_deg10 || nOrient == 1800_deg10 ||
306 ( nOrient == 900_deg10 && !bSkipLeft ) ||
307 ( nOrient == 2700_deg10 && !bSkipRight )))
308 {
309 nSpace = m_nShadowWidth;
310 }
311 break;
312
313 case SvxShadowItemSide::LEFT:
314 if(( aLoc == SvxShadowLocation::TopLeft ||
315 aLoc == SvxShadowLocation::BottomLeft ) &&
316 ( nOrient == 900_deg10 || nOrient == 2700_deg10 ||
317 ( nOrient == 0_deg10 && !bSkipLeft ) ||
318 ( nOrient == 1800_deg10 && !bSkipRight )))
319 {
320 nSpace = m_nShadowWidth;
321 }
322 break;
323
324 case SvxShadowItemSide::RIGHT:
325 if(( aLoc == SvxShadowLocation::TopRight ||
326 aLoc == SvxShadowLocation::BottomRight ) &&
327 ( nOrient == 900_deg10 || nOrient == 2700_deg10 ||
328 ( nOrient == 0_deg10 && !bSkipRight ) ||
329 ( nOrient == 1800_deg10 && !bSkipLeft )))
330 {
331 nSpace = m_nShadowWidth;
332 }
333 break;
334 default:
335 assert(false);
336 break;
337 }
338
339 return nSpace;
340}
341
342// maps directions for vertical layout
343static Degree10 MapDirection(Degree10 nDir, const bool bVertFormat, const bool bVertFormatLRBT)
344{
345 if ( bVertFormat )
346 {
347 switch ( nDir.get() )
348 {
349 case 0 :
350 if (bVertFormatLRBT)
351 nDir = 900_deg10;
352 else
353 nDir = 2700_deg10;
354 break;
355 case 900 :
356 nDir = 0_deg10;
357 break;
358 case 2700 :
359 nDir = 1800_deg10;
360 break;
361#if OSL_DEBUG_LEVEL > 0
362 default :
363 OSL_FAIL( "Unsupported direction" );
364 break;
365#endif
366 }
367 }
368 return nDir;
369}
370
371// maps the absolute direction set at the font to its logical counterpart
372// in the rotated environment
373Degree10 UnMapDirection(Degree10 nDir, const bool bVertFormat, const bool bVertFormatLRBT)
374{
375 if (bVertFormatLRBT)
376 {
377 switch (nDir.get())
378 {
379 case 900:
380 nDir = 0_deg10;
381 break;
382 default:
383 SAL_WARN("sw.core", "unsupported direction for VertLRBT");
384 break;
385 }
386 return nDir;
387 }
388
389 if ( bVertFormat )
390 {
391 switch ( nDir.get() )
392 {
393 case 0 :
394 nDir = 900_deg10;
395 break;
396 case 1800 :
397 nDir = 2700_deg10;
398 break;
399 case 2700 :
400 nDir = 0_deg10;
401 break;
402#if OSL_DEBUG_LEVEL > 0
403 default :
404 OSL_FAIL( "Unsupported direction" );
405 break;
406#endif
407 }
408 }
409 return nDir;
410}
411
412Degree10 SwFont::GetOrientation(const bool bVertFormat, const bool bVertFormatLRBT) const
413{
414 return UnMapDirection(m_aSub[m_nActual].GetOrientation(), bVertFormat, bVertFormatLRBT);
415}
416
417void SwFont::SetVertical(Degree10 nDir, const bool bVertFormat, const bool bVertLayoutLRBT)
418{
419 // map direction if frame has vertical layout
420 nDir = MapDirection(nDir, bVertFormat, bVertLayoutLRBT);
421
423 {
424 m_bFontChg = true;
425 bool bVertical = bVertFormat && !bVertLayoutLRBT;
426 m_aSub[SwFontScript::Latin].SetVertical(nDir, bVertical);
427 m_aSub[SwFontScript::CJK].SetVertical(nDir, bVertical);
428 m_aSub[SwFontScript::CTL].SetVertical(nDir, bVertical);
429 }
430}
431
432/*
433 Escapement:
434 frEsc: Fraction, ratio of Escapements
435 Esc = resulting Escapement
436 A1 = original Ascent (nOrgAscent)
437 A2 = shrunk Ascent (nEscAscent)
438 Ax = resulting Ascent (GetAscent())
439 H1 = original Height (nOrgHeight)
440 H2 = shrunk Height (nEscHeight)
441 Hx = resulting Height (GetHeight())
442 Bx = resulting Baseline for Text (CalcPos())
443 (Attention: Y - A1!)
444
445 Escapement:
446 Esc = H1 * frEsc;
447
448 Superscript:
449 Ax = A2 + Esc;
450 Hx = H2 + Esc;
451 Bx = A1 - Esc;
452
453 Subscript:
454 Ax = A1;
455 Hx = A1 + Esc + (H2 - A2);
456 Bx = A1 + Esc;
457*/
458
459// nEsc is the percentage
460sal_uInt16 SwSubFont::CalcEscAscent( const sal_uInt16 nOldAscent ) const
461{
464 {
465 const tools::Long nAscent = nOldAscent +
466 ( static_cast<tools::Long>(m_nOrgHeight) * GetEscapement() ) / 100;
467 if ( nAscent>0 )
468 return std::max<sal_uInt16>( nAscent, m_nOrgAscent );
469 }
470 return m_nOrgAscent;
471}
472
473void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
474 const IDocumentSettingAccess *pIDocumentSettingAccess )
475{
476 mxBackColor.reset();
477
478 if( pAttrSet )
479 {
480
481 if( const SvxFontItem* pFont = pAttrSet->GetItemIfSet( RES_CHRATR_FONT ) )
482 {
483 m_aSub[SwFontScript::Latin].SetFamily( pFont->GetFamily() );
484 m_aSub[SwFontScript::Latin].Font::SetFamilyName( pFont->GetFamilyName() );
485 m_aSub[SwFontScript::Latin].Font::SetStyleName( pFont->GetStyleName() );
486 m_aSub[SwFontScript::Latin].Font::SetPitch( pFont->GetPitch() );
487 m_aSub[SwFontScript::Latin].Font::SetCharSet( pFont->GetCharSet() );
488 }
489 if( const SvxFontHeightItem *pHeight = pAttrSet->GetItemIfSet( RES_CHRATR_FONTSIZE ) )
490 {
491 m_aSub[SwFontScript::Latin].SvxFont::SetPropr( 100 );
492 m_aSub[SwFontScript::Latin].m_aSize = m_aSub[SwFontScript::Latin].Font::GetFontSize();
493 Size aTmpSize = m_aSub[SwFontScript::Latin].m_aSize;
494 aTmpSize.setHeight( pHeight->GetHeight() );
495 m_aSub[SwFontScript::Latin].SetSize( aTmpSize );
496 }
497 if( const SvxPostureItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_POSTURE ) )
498 m_aSub[SwFontScript::Latin].Font::SetItalic( pItem->GetPosture() );
499 if( const SvxWeightItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_WEIGHT ) )
500 m_aSub[SwFontScript::Latin].Font::SetWeight( pItem->GetWeight() );
501 if( const SvxLanguageItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_LANGUAGE ) )
502 m_aSub[SwFontScript::Latin].SetLanguage( pItem->GetLanguage() );
503
504 if( const SvxFontItem* pFont = pAttrSet->GetItemIfSet( RES_CHRATR_CJK_FONT ) )
505 {
506 m_aSub[SwFontScript::CJK].SetFamily( pFont->GetFamily() );
507 m_aSub[SwFontScript::CJK].Font::SetFamilyName( pFont->GetFamilyName() );
508 m_aSub[SwFontScript::CJK].Font::SetStyleName( pFont->GetStyleName() );
509 m_aSub[SwFontScript::CJK].Font::SetPitch( pFont->GetPitch() );
510 m_aSub[SwFontScript::CJK].Font::SetCharSet( pFont->GetCharSet() );
511 }
512 if( const SvxFontHeightItem* pHeight = pAttrSet->GetItemIfSet( RES_CHRATR_CJK_FONTSIZE) )
513 {
514 m_aSub[SwFontScript::CJK].SvxFont::SetPropr( 100 );
515 m_aSub[SwFontScript::CJK].m_aSize = m_aSub[SwFontScript::CJK].Font::GetFontSize();
516 Size aTmpSize = m_aSub[SwFontScript::CJK].m_aSize;
517 aTmpSize.setHeight( pHeight->GetHeight() );
518 m_aSub[SwFontScript::CJK].SetSize( aTmpSize );
519 }
520 if( const SvxPostureItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_CJK_POSTURE ) )
521 m_aSub[SwFontScript::CJK].Font::SetItalic( pItem->GetPosture() );
522 if( const SvxWeightItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_CJK_WEIGHT ) )
523 m_aSub[SwFontScript::CJK].Font::SetWeight( pItem->GetWeight() );
524 if( const SvxLanguageItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_CJK_LANGUAGE ) )
525 {
526 LanguageType eNewLang = pItem->GetLanguage();
527 m_aSub[SwFontScript::CJK].SetLanguage( eNewLang );
528 m_aSub[SwFontScript::Latin].SetCJKContextLanguage( eNewLang );
529 m_aSub[SwFontScript::CJK].SetCJKContextLanguage( eNewLang );
530 m_aSub[SwFontScript::CTL].SetCJKContextLanguage( eNewLang );
531 }
532
533 if( const SvxFontItem* pFont = pAttrSet->GetItemIfSet( RES_CHRATR_CTL_FONT ) )
534 {
535 m_aSub[SwFontScript::CTL].SetFamily( pFont->GetFamily() );
536 m_aSub[SwFontScript::CTL].Font::SetFamilyName( pFont->GetFamilyName() );
537 m_aSub[SwFontScript::CTL].Font::SetStyleName( pFont->GetStyleName() );
538 m_aSub[SwFontScript::CTL].Font::SetPitch( pFont->GetPitch() );
539 m_aSub[SwFontScript::CTL].Font::SetCharSet( pFont->GetCharSet() );
540 }
541 if( const SvxFontHeightItem* pHeight = pAttrSet->GetItemIfSet( RES_CHRATR_CTL_FONTSIZE ) )
542 {
543 m_aSub[SwFontScript::CTL].SvxFont::SetPropr( 100 );
544 m_aSub[SwFontScript::CTL].m_aSize = m_aSub[SwFontScript::CTL].Font::GetFontSize();
545 Size aTmpSize = m_aSub[SwFontScript::CTL].m_aSize;
546 aTmpSize.setHeight( pHeight->GetHeight() );
547 m_aSub[SwFontScript::CTL].SetSize( aTmpSize );
548 }
549 if( const SvxPostureItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_CTL_POSTURE ) )
550 m_aSub[SwFontScript::CTL].Font::SetItalic(pItem->GetPosture() );
551 if( const SvxWeightItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_CTL_WEIGHT ) )
552 m_aSub[SwFontScript::CTL].Font::SetWeight( pItem->GetWeight() );
553 if( const SvxLanguageItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_CTL_LANGUAGE ) )
554 m_aSub[SwFontScript::CTL].SetLanguage( pItem->GetLanguage() );
555
556 if( const SvxUnderlineItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_UNDERLINE ) )
557 {
558 SetUnderline( pItem->GetLineStyle() );
559 SetUnderColor( pItem->GetColor() );
560 }
561 if( const SvxOverlineItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_OVERLINE ) )
562 {
563 SetOverline( pItem->GetLineStyle() );
564 SetOverColor( pItem->GetColor() );
565 }
566 if( const SvxCrossedOutItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_CROSSEDOUT ) )
567 SetStrikeout( pItem->GetStrikeout() );
568 if( const SvxColorItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_COLOR ) )
569 SetColor( pItem->GetValue() );
570 if( const SvxEmphasisMarkItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_EMPHASIS_MARK ))
571 SetEmphasisMark( pItem->GetEmphasisMark() );
572
573 SetTransparent( true );
575 if( const SvxContourItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_CONTOUR ) )
576 SetOutline( pItem->GetValue() );
577 if( const SvxShadowedItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_SHADOWED ) )
578 SetShadow( pItem->GetValue() );
579 if( const SvxCharReliefItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_RELIEF ) )
580 SetRelief( pItem->GetValue() );
581 if( const SvxShadowedItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_SHADOWED ))
582 SetPropWidth( pItem->GetValue() ? 50 : 100 );
583 if( const SvxAutoKernItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_AUTOKERN ) )
584 {
585 if( pItem->GetValue() )
586 {
587 SetAutoKern( ( !pIDocumentSettingAccess ||
588 !pIDocumentSettingAccess->get(DocumentSettingId::KERN_ASIAN_PUNCTUATION) ) ?
589 FontKerning::FontSpecific :
590 FontKerning::Asian );
591 }
592 else
593 SetAutoKern( FontKerning::NONE );
594 }
595 if( const SvxWordLineModeItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_WORDLINEMODE ) )
596 SetWordLineMode( pItem->GetValue() );
597
598 if( const SvxEscapementItem* pEsc = pAttrSet->GetItemIfSet( RES_CHRATR_ESCAPEMENT ) )
599 {
600 SetEscapement( pEsc->GetEsc() );
601 if( m_aSub[SwFontScript::Latin].IsEsc() )
602 SetProportion( pEsc->GetProportionalHeight() );
603 }
604 if( const SvxCaseMapItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_CASEMAP ) )
605 SetCaseMap( pItem->GetCaseMap() );
606 if( const SvxKerningItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_KERNING ) )
607 SetFixKerning( pItem->GetValue() );
608 if( const SvxCharRotateItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_ROTATE ) )
609 SetVertical( pItem->GetValue() );
610 if( const SvxBrushItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_BACKGROUND ) )
611 mxBackColor = pItem->GetColor();
612 if( const SvxBrushItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_HIGHLIGHT ) )
613 SetHighlightColor(pItem->GetColor());
614 if( const SvxBoxItem* pBoxItem = pAttrSet->GetItemIfSet( RES_CHRATR_BOX ) )
615 {
616 SetTopBorder(pBoxItem->GetTop());
617 SetBottomBorder(pBoxItem->GetBottom());
618 SetRightBorder(pBoxItem->GetRight());
619 SetLeftBorder(pBoxItem->GetLeft());
620 SetTopBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::TOP));
621 SetBottomBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::BOTTOM));
622 SetRightBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::RIGHT));
623 SetLeftBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::LEFT));
624 }
625 if( const SvxShadowItem* pShadowItem = pAttrSet->GetItemIfSet( RES_CHRATR_SHADOW ) )
626 {
627 SetShadowColor(pShadowItem->GetColor());
628 SetShadowWidth(pShadowItem->GetWidth());
629 SetShadowLocation(pShadowItem->GetLocation());
630 }
631 const SvxTwoLinesItem* pTwoLinesItem = pAttrSet->GetItemIfSet( RES_CHRATR_TWO_LINES );
632 if( pTwoLinesItem && pTwoLinesItem->GetValue() )
633 SetVertical( 0_deg10 );
634 }
635 else
636 {
637 Invalidate();
638 }
639 m_bPaintBlank = false;
640 OSL_ENSURE( m_aSub[SwFontScript::Latin].IsTransparent(), "SwFont: Transparent revolution" );
641}
642
643SwFont::SwFont( const SwFont &rFont )
644 : m_aSub(rFont.m_aSub)
645{
646 m_nActual = rFont.m_nActual;
647 mxBackColor = rFont.mxBackColor;
661 m_aOverColor = rFont.GetOverColor();
662 m_nToxCount = 0;
663 m_nRefCount = 0;
664 m_nMetaCount = 0;
667 m_bFontChg = rFont.m_bFontChg;
668 m_bOrgChg = rFont.m_bOrgChg;
670 m_bGreyWave = rFont.m_bGreyWave;
671}
672
673SwFont::SwFont( const SwAttrSet* pAttrSet,
674 const IDocumentSettingAccess* pIDocumentSettingAccess )
675 : m_aSub()
676{
678 m_nToxCount = 0;
679 m_nRefCount = 0;
680 m_nMetaCount = 0;
683 m_bPaintBlank = false;
684 m_bGreyWave = false;
685 m_bOrgChg = true;
686 {
687 const SvxFontItem& rFont = pAttrSet->GetFont();
688 m_aSub[SwFontScript::Latin].SetFamily( rFont.GetFamily() );
689 m_aSub[SwFontScript::Latin].SetFamilyName( rFont.GetFamilyName() );
690 m_aSub[SwFontScript::Latin].SetStyleName( rFont.GetStyleName() );
691 m_aSub[SwFontScript::Latin].SetPitch( rFont.GetPitch() );
692 m_aSub[SwFontScript::Latin].SetCharSet( rFont.GetCharSet() );
693 m_aSub[SwFontScript::Latin].SvxFont::SetPropr( 100 ); // 100% of FontSize
694 Size aTmpSize = m_aSub[SwFontScript::Latin].m_aSize;
695 aTmpSize.setHeight( pAttrSet->GetSize().GetHeight() );
696 m_aSub[SwFontScript::Latin].SetSize( aTmpSize );
697 m_aSub[SwFontScript::Latin].SetItalic( pAttrSet->GetPosture().GetPosture() );
698 m_aSub[SwFontScript::Latin].SetWeight( pAttrSet->GetWeight().GetWeight() );
699 m_aSub[SwFontScript::Latin].SetLanguage( pAttrSet->GetLanguage().GetLanguage() );
700 }
701
702 {
703 const SvxFontItem& rFont = pAttrSet->GetCJKFont();
704 m_aSub[SwFontScript::CJK].SetFamily( rFont.GetFamily() );
705 m_aSub[SwFontScript::CJK].SetFamilyName( rFont.GetFamilyName() );
706 m_aSub[SwFontScript::CJK].SetStyleName( rFont.GetStyleName() );
707 m_aSub[SwFontScript::CJK].SetPitch( rFont.GetPitch() );
708 m_aSub[SwFontScript::CJK].SetCharSet( rFont.GetCharSet() );
709 m_aSub[SwFontScript::CJK].SvxFont::SetPropr( 100 ); // 100% of FontSize
710 Size aTmpSize = m_aSub[SwFontScript::CJK].m_aSize;
711 aTmpSize.setHeight( pAttrSet->GetCJKSize().GetHeight() );
712 m_aSub[SwFontScript::CJK].SetSize( aTmpSize );
713 m_aSub[SwFontScript::CJK].SetItalic( pAttrSet->GetCJKPosture().GetPosture() );
714 m_aSub[SwFontScript::CJK].SetWeight( pAttrSet->GetCJKWeight().GetWeight() );
715 LanguageType eNewLang = pAttrSet->GetCJKLanguage().GetLanguage();
716 m_aSub[SwFontScript::CJK].SetLanguage( eNewLang );
717 m_aSub[SwFontScript::Latin].SetCJKContextLanguage( eNewLang );
718 m_aSub[SwFontScript::CJK].SetCJKContextLanguage( eNewLang );
719 m_aSub[SwFontScript::CTL].SetCJKContextLanguage( eNewLang );
720 }
721
722 {
723 const SvxFontItem& rFont = pAttrSet->GetCTLFont();
724 m_aSub[SwFontScript::CTL].SetFamily( rFont.GetFamily() );
725 m_aSub[SwFontScript::CTL].SetFamilyName( rFont.GetFamilyName() );
726 m_aSub[SwFontScript::CTL].SetStyleName( rFont.GetStyleName() );
727 m_aSub[SwFontScript::CTL].SetPitch( rFont.GetPitch() );
728 m_aSub[SwFontScript::CTL].SetCharSet( rFont.GetCharSet() );
729 m_aSub[SwFontScript::CTL].SvxFont::SetPropr( 100 ); // 100% of FontSize
730 Size aTmpSize = m_aSub[SwFontScript::CTL].m_aSize;
731 aTmpSize.setHeight( pAttrSet->GetCTLSize().GetHeight() );
732 m_aSub[SwFontScript::CTL].SetSize( aTmpSize );
733 m_aSub[SwFontScript::CTL].SetItalic( pAttrSet->GetCTLPosture().GetPosture() );
734 m_aSub[SwFontScript::CTL].SetWeight( pAttrSet->GetCTLWeight().GetWeight() );
735 m_aSub[SwFontScript::CTL].SetLanguage( pAttrSet->GetCTLLanguage().GetLanguage() );
736 }
737 if ( pAttrSet->GetCharHidden().GetValue() )
739 else
740 SetUnderline( pAttrSet->GetUnderline().GetLineStyle() );
741 SetUnderColor( pAttrSet->GetUnderline().GetColor() );
742 SetOverline( pAttrSet->GetOverline().GetLineStyle() );
743 SetOverColor( pAttrSet->GetOverline().GetColor() );
745 SetStrikeout( pAttrSet->GetCrossedOut().GetStrikeout() );
746 SetColor( pAttrSet->GetColor().GetValue() );
747 SetTransparent( true );
749 SetOutline( pAttrSet->GetContour().GetValue() );
750 SetShadow( pAttrSet->GetShadowed().GetValue() );
751 SetPropWidth( pAttrSet->GetCharScaleW().GetValue() );
752 SetRelief( pAttrSet->GetCharRelief().GetValue() );
753 if( pAttrSet->GetAutoKern().GetValue() )
754 {
755 SetAutoKern( ( !pIDocumentSettingAccess ||
756 !pIDocumentSettingAccess->get(DocumentSettingId::KERN_ASIAN_PUNCTUATION) ) ?
757 FontKerning::FontSpecific :
758 FontKerning::Asian );
759 }
760 else
761 SetAutoKern( FontKerning::NONE );
762 SetWordLineMode( pAttrSet->GetWordLineMode().GetValue() );
763 const SvxEscapementItem &rEsc = pAttrSet->GetEscapement();
764 SetEscapement( rEsc.GetEsc() );
765 if( m_aSub[SwFontScript::Latin].IsEsc() )
767 SetCaseMap( pAttrSet->GetCaseMap().GetCaseMap() );
768 SetFixKerning( pAttrSet->GetKerning().GetValue() );
769 if( const SvxBrushItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_BACKGROUND ) )
770 mxBackColor = pItem->GetColor();
771 if( const SvxBrushItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_HIGHLIGHT ) )
772 SetHighlightColor(pItem->GetColor());
773 else
775 if( const SvxBoxItem* pBoxItem = pAttrSet->GetItemIfSet( RES_CHRATR_BOX ) )
776 {
777 SetTopBorder(pBoxItem->GetTop());
778 SetBottomBorder(pBoxItem->GetBottom());
779 SetRightBorder(pBoxItem->GetRight());
780 SetLeftBorder(pBoxItem->GetLeft());
781 SetTopBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::TOP));
782 SetBottomBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::BOTTOM));
783 SetRightBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::RIGHT));
784 SetLeftBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::LEFT));
785 }
786 else
787 {
788 SetTopBorder(nullptr);
789 SetBottomBorder(nullptr);
790 SetRightBorder(nullptr);
791 SetLeftBorder(nullptr);
796 }
797
798 if( const SvxShadowItem* pShadowItem = pAttrSet->GetItemIfSet( RES_CHRATR_SHADOW ) )
799 {
800 SetShadowColor(pShadowItem->GetColor());
801 SetShadowWidth(pShadowItem->GetWidth());
802 SetShadowLocation(pShadowItem->GetLocation());
803 }
804 else
805 {
808 SetShadowLocation(SvxShadowLocation::NONE);
809 }
810
811 const SvxTwoLinesItem& rTwoLinesItem = pAttrSet->Get2Lines();
812 if ( ! rTwoLinesItem.GetValue() )
813 SetVertical( pAttrSet->GetCharRotate().GetValue() );
814 else
815 SetVertical( 0_deg10 );
816 if( pIDocumentSettingAccess && pIDocumentSettingAccess->get( DocumentSettingId::SMALL_CAPS_PERCENTAGE_66 ))
817 {
818 m_aSub[ SwFontScript::Latin ].m_bSmallCapsPercentage66 = true;
819 m_aSub[ SwFontScript::CJK ].m_bSmallCapsPercentage66 = true;
820 m_aSub[ SwFontScript::CTL ].m_bSmallCapsPercentage66 = true;
821 }
822}
823
825{
826}
827
829{
830 if (this != &rFont)
831 {
835 m_nActual = rFont.m_nActual;
836 mxBackColor = rFont.mxBackColor;
850 m_aOverColor = rFont.GetOverColor();
851 m_nToxCount = 0;
852 m_nRefCount = 0;
853 m_nMetaCount = 0;
856 m_bFontChg = rFont.m_bFontChg;
857 m_bOrgChg = rFont.m_bOrgChg;
859 m_bGreyWave = rFont.m_bGreyWave;
860 }
861 return *this;
862}
863
865{
866 SwFntAccess aFntAccess( m_aSub[nWhich].m_nFontCacheId, m_aSub[nWhich].m_nFontIndex,
867 &m_aSub[nWhich], pSh, true );
868}
869
871{
872 SwFntAccess aFntAccess( m_nFontCacheId, m_nFontIndex, this, pSh, false );
873 return aFntAccess.Get()->IsSymbol();
874}
875
877{
878 if ( pLastFont )
879 pLastFont->Unlock();
880 SwFntAccess aFntAccess( m_nFontCacheId, m_nFontIndex, this, pSh, true );
881 SV_STAT( nChangeFont );
882
883 pLastFont = aFntAccess.Get();
884
885 pLastFont->SetDevFont( pSh, rOut );
886
887 pLastFont->Lock();
888 return LINESTYLE_NONE != GetUnderline() ||
889 LINESTYLE_NONE != GetOverline() ||
890 STRIKEOUT_NONE != GetStrikeout();
891}
892
894{
895 if( m_bOrgChg && m_aSub[m_nActual].IsEsc() )
896 {
897 const sal_uInt8 nOldProp = m_aSub[m_nActual].GetPropr();
898 SetProportion( 100 );
899 ChgFnt( pSh, rOut );
900 SwFntAccess aFntAccess( m_aSub[m_nActual].m_nFontCacheId, m_aSub[m_nActual].m_nFontIndex,
901 &m_aSub[m_nActual], pSh );
902 m_aSub[m_nActual].m_nOrgHeight = aFntAccess.Get()->GetFontHeight( pSh, rOut );
903 m_aSub[m_nActual].m_nOrgAscent = aFntAccess.Get()->GetFontAscent( pSh, rOut );
904 SetProportion( nOldProp );
905 m_bOrgChg = false;
906 }
907
908 if( m_bFontChg )
909 {
910 ChgFnt( pSh, rOut );
912 }
913 if( rOut.GetTextLineColor() != m_aUnderColor )
915 if( rOut.GetOverlineColor() != m_aOverColor )
917}
918
919// Height = MaxAscent + MaxDescent
920// MaxAscent = Max (T1_ascent, T2_ascent + (Esc * T1_height) );
921// MaxDescent = Max (T1_height-T1_ascent,
922// T2_height-T2_ascent - (Esc * T1_height)
923sal_uInt16 SwSubFont::CalcEscHeight( const sal_uInt16 nOldHeight,
924 const sal_uInt16 nOldAscent ) const
925{
928 {
929 tools::Long nDescent = nOldHeight - nOldAscent -
930 ( static_cast<tools::Long>(m_nOrgHeight) * GetEscapement() ) / 100;
931 const sal_uInt16 nDesc = nDescent>0
932 ? std::max<sal_uInt16>( nDescent, m_nOrgHeight - m_nOrgAscent)
934 return ( nDesc + CalcEscAscent( nOldAscent ) );
935 }
936 return m_nOrgHeight;
937}
938
940{
941 short nKernx = - short( Font::GetFontSize().Height() / 6 );
942
943 if ( nKernx < GetFixKerning() )
944 return GetFixKerning();
945 return nKernx;
946}
947
948sal_uInt16 SwSubFont::GetAscent( SwViewShell const *pSh, const OutputDevice& rOut )
949{
950 SwFntAccess aFntAccess( m_nFontCacheId, m_nFontIndex, this, pSh );
951 const sal_uInt16 nAscent = aFntAccess.Get()->GetFontAscent( pSh, rOut );
952 return GetEscapement() ? CalcEscAscent( nAscent ) : nAscent;
953}
954
955sal_uInt16 SwSubFont::GetHeight( SwViewShell const *pSh, const OutputDevice& rOut )
956{
957 SV_STAT( nGetTextSize );
958 SwFntAccess aFntAccess( m_nFontCacheId, m_nFontIndex, this, pSh );
959 const sal_uInt16 nHeight = aFntAccess.Get()->GetFontHeight( pSh, rOut );
960 if ( GetEscapement() )
961 {
962 const sal_uInt16 nAscent = aFntAccess.Get()->GetFontAscent( pSh, rOut );
963 return CalcEscHeight( nHeight, nAscent ); // + nLeading;
964 }
965 return nHeight; // + nLeading;
966}
967
968sal_uInt16 SwSubFont::GetHangingBaseline( SwViewShell const *pSh, const OutputDevice& rOut )
969{
970 SwFntAccess aFntAccess( m_nFontCacheId, m_nFontIndex, this, pSh );
971 return aFntAccess.Get()->GetFontHangingBaseline( pSh, rOut );
972}
973
975{
976 // Robust: the font is supposed to be set already, but better safe than
977 // sorry...
979 !IsSameInstance( rInf.GetpOut()->GetFont() ) )
980 ChgFnt( rInf.GetShell(), rInf.GetOut() );
981
982 SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
983
984 Size aTextSize;
986 ? TextFrameIndex(rInf.GetText().getLength())
987 : rInf.GetLen();
988 rInf.SetLen( nLn );
989
990 if( IsCapital() && nLn )
991 {
993 {
994 rInf.SetLen(rInf.GetMeasureLen());
996 }
997 aTextSize = GetCapitalSize( rInf );
998 }
999 else
1000 {
1001 SV_STAT( nGetTextSize );
1002 tools::Long nOldKern = rInf.GetKern();
1003 const OUString oldText = rInf.GetText();
1004 rInf.SetKern( CheckKerning() );
1005 if ( !IsCaseMap() )
1006 aTextSize = pLastFont->GetTextSize( rInf );
1007 else
1008 {
1009 const OUString aTmp = CalcCaseMap( rInf.GetText() );
1010 const OUString oldStr = rInf.GetText();
1011 bool bCaseMapLengthDiffers(aTmp.getLength() != oldStr.getLength());
1012
1013 if(bCaseMapLengthDiffers && rInf.GetLen())
1014 {
1015 // If the length of the original string and the CaseMapped one
1016 // are different, it is necessary to handle the given text part as
1017 // a single snippet since its size may differ, too.
1018 TextFrameIndex const nOldIdx(rInf.GetIdx());
1019 TextFrameIndex const nOldLen(rInf.GetLen());
1020 TextFrameIndex const nOldMeasureLen(rInf.GetMeasureLen());
1021 const OUString aSnippet(oldStr.copy(sal_Int32(nOldIdx), sal_Int32(nOldLen)));
1022 const OUString aNewText(CalcCaseMap(aSnippet));
1023
1024 rInf.SetText( aNewText );
1025 rInf.SetIdx( TextFrameIndex(0) );
1026 rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
1027 if (nOldMeasureLen != TextFrameIndex(COMPLETE_STRING))
1028 {
1029 const OUString aMeasureSnippet(oldStr.copy(sal_Int32(nOldIdx), sal_Int32(nOldMeasureLen)));
1030 const OUString aNewMeasureText(CalcCaseMap(aMeasureSnippet));
1031 rInf.SetMeasureLen(TextFrameIndex(aNewMeasureText.getLength()));
1032 }
1033
1034 aTextSize = pLastFont->GetTextSize( rInf );
1035
1036 rInf.SetIdx( nOldIdx );
1037 rInf.SetLen( nOldLen );
1038 rInf.SetMeasureLen(nOldMeasureLen);
1039 }
1040 else
1041 {
1042 rInf.SetText( aTmp );
1043 aTextSize = pLastFont->GetTextSize( rInf );
1044 }
1045
1046 rInf.SetText(oldStr);
1047 }
1048 rInf.SetKern( nOldKern );
1049 rInf.SetText(oldText);
1050 // A word that's longer than one line, with escapement at the line
1051 // break, must report its effective height.
1052 if( GetEscapement() )
1053 {
1054 const sal_uInt16 nAscent = pLastFont->GetFontAscent( rInf.GetShell(),
1055 rInf.GetOut() );
1056 aTextSize.setHeight(
1057 static_cast<tools::Long>(CalcEscHeight( o3tl::narrowing<sal_uInt16>(aTextSize.Height()), nAscent)) );
1058 }
1059 }
1060
1061 if (TextFrameIndex(1) == rInf.GetLen()
1062 && CH_TXT_ATR_FIELDSTART == rInf.GetText()[sal_Int32(rInf.GetIdx())])
1063 {
1064 assert(!"this is presumably dead code");
1065 TextFrameIndex const nOldIdx(rInf.GetIdx());
1066 TextFrameIndex const nOldLen(rInf.GetLen());
1067 const OUString aNewText(CH_TXT_ATR_SUBST_FIELDSTART);
1068 rInf.SetText( aNewText );
1069 rInf.SetIdx( TextFrameIndex(0) );
1070 rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
1071 aTextSize = pLastFont->GetTextSize( rInf );
1072 rInf.SetIdx( nOldIdx );
1073 rInf.SetLen( nOldLen );
1074 }
1075 else if (TextFrameIndex(1) == rInf.GetLen()
1076 && CH_TXT_ATR_FIELDEND == rInf.GetText()[sal_Int32(rInf.GetIdx())])
1077 {
1078 assert(!"this is presumably dead code");
1079 TextFrameIndex const nOldIdx(rInf.GetIdx());
1080 TextFrameIndex const nOldLen(rInf.GetLen());
1081 const OUString aNewText(CH_TXT_ATR_SUBST_FIELDEND);
1082 rInf.SetText( aNewText );
1083 rInf.SetIdx( TextFrameIndex(0) );
1084 rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
1085 aTextSize = pLastFont->GetTextSize( rInf );
1086 rInf.SetIdx( nOldIdx );
1087 rInf.SetLen( nOldLen );
1088 }
1089
1090 return aTextSize;
1091}
1092
1093void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey )
1094{
1095 rInf.SetGreyWave( bGrey );
1096 TextFrameIndex const nLn(rInf.GetText().getLength());
1097 if( !rInf.GetLen() || !nLn )
1098 return;
1099 if (TextFrameIndex(COMPLETE_STRING) == rInf.GetLen())
1100 rInf.SetLen( nLn );
1101
1102 FontLineStyle nOldUnder = LINESTYLE_NONE;
1103 SwUnderlineFont* pUnderFnt = nullptr;
1104
1105 if( rInf.GetUnderFnt() )
1106 {
1107 nOldUnder = GetUnderline();
1109 pUnderFnt = rInf.GetUnderFnt();
1110 }
1111
1113 ChgFnt( rInf.GetShell(), rInf.GetOut() );
1114
1115 SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
1116
1117 const Point aOldPos(rInf.GetPos());
1118 Point aPos( rInf.GetPos() );
1119
1120 if( GetEscapement() )
1121 CalcEsc( rInf, aPos );
1122
1123 rInf.SetPos( aPos );
1125
1126 if( IsCapital() )
1127 DrawCapital( rInf );
1128 else
1129 {
1130 SV_STAT( nDrawText );
1131 if ( !IsCaseMap() )
1132 pLastFont->DrawText( rInf );
1133 else
1134 {
1135 const OUString oldStr = rInf.GetText();
1136 const OUString aString( CalcCaseMap(oldStr) );
1137 bool bCaseMapLengthDiffers(aString.getLength() != oldStr.getLength());
1138
1139 if(bCaseMapLengthDiffers && rInf.GetLen())
1140 {
1141 // If the length of the original string and the CaseMapped one
1142 // are different, it is necessary to handle the given text part as
1143 // a single snippet since its size may differ, too.
1144 TextFrameIndex const nOldIdx(rInf.GetIdx());
1145 TextFrameIndex const nOldLen(rInf.GetLen());
1146 const OUString aSnippet(oldStr.copy(sal_Int32(nOldIdx), sal_Int32(nOldLen)));
1147 const OUString aNewText = CalcCaseMap(aSnippet);
1148
1149 rInf.SetText( aNewText );
1150 rInf.SetIdx( TextFrameIndex(0) );
1151 rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
1152
1153 pLastFont->DrawText( rInf );
1154
1155 rInf.SetIdx( nOldIdx );
1156 rInf.SetLen( nOldLen );
1157 }
1158 else
1159 {
1160 rInf.SetText( aString );
1161 pLastFont->DrawText( rInf );
1162 }
1163
1164 rInf.SetText(oldStr);
1165 }
1166 }
1167
1168 if( pUnderFnt && nOldUnder != LINESTYLE_NONE )
1169 {
1170 Size aFontSize = GetTextSize_( rInf );
1171 const OUString oldStr = rInf.GetText();
1172
1173 TextFrameIndex const nOldIdx = rInf.GetIdx();
1174 TextFrameIndex const nOldLen = rInf.GetLen();
1175 tools::Long nSpace = 0;
1176 if( rInf.GetSpace() )
1177 {
1178 TextFrameIndex nTmpEnd = nOldIdx + nOldLen;
1179 if (nTmpEnd > TextFrameIndex(oldStr.getLength()))
1180 nTmpEnd = TextFrameIndex(oldStr.getLength());
1181
1182 const SwScriptInfo* pSI = rInf.GetScriptInfo();
1183
1184 const bool bAsianFont =
1185 ( rInf.GetFont() && SwFontScript::CJK == rInf.GetFont()->GetActual() );
1186 for (TextFrameIndex nTmp = nOldIdx; nTmp < nTmpEnd; ++nTmp)
1187 {
1188 if (CH_BLANK == oldStr[sal_Int32(nTmp)] || bAsianFont ||
1189 (nTmp + TextFrameIndex(1) < TextFrameIndex(oldStr.getLength())
1190 && pSI
1191 && i18n::ScriptType::ASIAN == pSI->ScriptType(nTmp + TextFrameIndex(1))))
1192 {
1193 ++nSpace;
1194 }
1195 }
1196
1197 // if next portion if a hole portion we do not consider any
1198 // extra space added because the last character was ASIAN
1199 if ( nSpace && rInf.IsSpaceStop() && bAsianFont )
1200 --nSpace;
1201
1202 nSpace *= rInf.GetSpace() / SPACING_PRECISION_FACTOR;
1203 }
1204
1205 rInf.SetWidth( sal_uInt16(aFontSize.Width() + nSpace) );
1206 rInf.SetTextIdxLen( " ", TextFrameIndex(0), TextFrameIndex(2) );
1207 SetUnderline( nOldUnder );
1208 rInf.SetUnderFnt( nullptr );
1209
1210 // set position for underline font
1211 rInf.SetPos( pUnderFnt->GetPos() );
1212
1213 pUnderFnt->GetFont().DrawStretchText_( rInf );
1214
1215 rInf.SetUnderFnt( pUnderFnt );
1216 rInf.SetTextIdxLen(oldStr, nOldIdx, nOldLen);
1217 }
1218
1219 rInf.SetPos(aOldPos);
1220}
1221
1223{
1224 if( !rInf.GetLen() || !rInf.GetText().getLength() )
1225 return;
1226
1227 FontLineStyle nOldUnder = LINESTYLE_NONE;
1228 SwUnderlineFont* pUnderFnt = nullptr;
1229
1230 if( rInf.GetUnderFnt() )
1231 {
1232 nOldUnder = GetUnderline();
1234 pUnderFnt = rInf.GetUnderFnt();
1235 }
1236
1238 ChgFnt( rInf.GetShell(), rInf.GetOut() );
1239
1240 SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
1241
1242 rInf.ApplyAutoColor();
1243
1244 const Point aOldPos(rInf.GetPos());
1245 Point aPos( rInf.GetPos() );
1246
1247 if( GetEscapement() )
1248 CalcEsc( rInf, aPos );
1249
1251 rInf.SetPos( aPos );
1252
1253 if( IsCapital() )
1254 DrawStretchCapital( rInf );
1255 else
1256 {
1257 SV_STAT( nDrawStretchText );
1258
1259 if ( rInf.GetFrame() )
1260 {
1261 if ( rInf.GetFrame()->IsRightToLeft() )
1262 rInf.GetFrame()->SwitchLTRtoRTL( aPos );
1263
1264 if ( rInf.GetFrame()->IsVertical() )
1265 rInf.GetFrame()->SwitchHorizontalToVertical( aPos );
1266
1267 rInf.SetPos( aPos );
1268 }
1269
1270 if ( !IsCaseMap() )
1271 rInf.GetOut().DrawStretchText( aPos, rInf.GetWidth(),
1272 rInf.GetText(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
1273 else
1274 rInf.GetOut().DrawStretchText( aPos, rInf.GetWidth(),
1275 CalcCaseMap(rInf.GetText()),
1276 sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
1277 }
1278
1279 if( pUnderFnt && nOldUnder != LINESTYLE_NONE )
1280 {
1281 const OUString oldStr = rInf.GetText();
1282 TextFrameIndex const nOldIdx = rInf.GetIdx();
1283 TextFrameIndex const nOldLen = rInf.GetLen();
1284 rInf.SetTextIdxLen( " ", TextFrameIndex(0), TextFrameIndex(2) );
1285 SetUnderline( nOldUnder );
1286 rInf.SetUnderFnt( nullptr );
1287
1288 // set position for underline font
1289 rInf.SetPos( pUnderFnt->GetPos() );
1290
1291 pUnderFnt->GetFont().DrawStretchText_( rInf );
1292
1293 rInf.SetUnderFnt( pUnderFnt );
1294 rInf.SetTextIdxLen(oldStr, nOldIdx, nOldLen);
1295 }
1296
1297 rInf.SetPos(aOldPos);
1298}
1299
1301{
1303 ChgFnt( rInf.GetShell(), rInf.GetOut() );
1304
1305 SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
1306
1308 ? TextFrameIndex(rInf.GetText().getLength())
1309 : rInf.GetLen();
1310 rInf.SetLen( nLn );
1311 TextFrameIndex nCursor(0);
1312 if( IsCapital() && nLn )
1313 nCursor = GetCapitalCursorOfst( rInf );
1314 else
1315 {
1316 const OUString oldText = rInf.GetText();
1317 tools::Long nOldKern = rInf.GetKern();
1318 rInf.SetKern( CheckKerning() );
1319 SV_STAT( nGetTextSize );
1320 if ( !IsCaseMap() )
1321 nCursor = pLastFont->GetModelPositionForViewPoint( rInf );
1322 else
1323 {
1324 rInf.SetText( CalcCaseMap( rInf.GetText() ) );
1325 nCursor = pLastFont->GetModelPositionForViewPoint( rInf );
1326 }
1327 rInf.SetKern( nOldKern );
1328 rInf.SetText(oldText);
1329 }
1330 return nCursor;
1331}
1332
1333void SwSubFont::CalcEsc( SwDrawTextInfo const & rInf, Point& rPos )
1334{
1335 tools::Long nOfst;
1336
1337 bool bVert = false;
1338 bool bVertLRBT = false;
1339 if (rInf.GetFrame())
1340 {
1341 bVert = rInf.GetFrame()->IsVertical();
1342 bVertLRBT = rInf.GetFrame()->IsVertLRBT();
1343 }
1344 const Degree10 nDir = UnMapDirection(GetOrientation(), bVert, bVertLRBT);
1345
1346 switch ( GetEscapement() )
1347 {
1348 case DFLT_ESC_AUTO_SUB :
1349 nOfst = m_nOrgHeight - m_nOrgAscent -
1350 pLastFont->GetFontHeight( rInf.GetShell(), rInf.GetOut() ) +
1351 pLastFont->GetFontAscent( rInf.GetShell(), rInf.GetOut() );
1352
1353 switch ( nDir.get() )
1354 {
1355 case 0 :
1356 rPos.AdjustY(nOfst );
1357 break;
1358 case 900 :
1359 rPos.AdjustX(nOfst );
1360 break;
1361 case 2700 :
1362 rPos.AdjustX( -nOfst );
1363 break;
1364 }
1365
1366 break;
1367 case DFLT_ESC_AUTO_SUPER :
1368 nOfst = pLastFont->GetFontAscent( rInf.GetShell(), rInf.GetOut() ) -
1370
1371 switch ( nDir.get() )
1372 {
1373 case 0 :
1374 rPos.AdjustY(nOfst );
1375 break;
1376 case 900 :
1377 rPos.AdjustX(nOfst );
1378 break;
1379 case 2700 :
1380 rPos.AdjustX( -nOfst );
1381 break;
1382 }
1383
1384 break;
1385 default :
1386 nOfst = (static_cast<tools::Long>(m_nOrgHeight) * GetEscapement()) / 100;
1387
1388 switch ( nDir.get() )
1389 {
1390 case 0 :
1391 rPos.AdjustY( -nOfst );
1392 break;
1393 case 900 :
1394 rPos.AdjustX( -nOfst );
1395 break;
1396 case 2700 :
1397 rPos.AdjustX(nOfst );
1398 break;
1399 }
1400 }
1401}
1402
1403// used during painting of small capitals
1405{
1406#ifdef DBG_UTIL
1407 OSL_ENSURE( m_bPos, "DrawTextInfo: Undefined Position" );
1408 OSL_ENSURE( m_bSize, "DrawTextInfo: Undefined Width" );
1409#endif
1410
1411 const bool bBidiPor = ( GetFrame() && GetFrame()->IsRightToLeft() ) !=
1413
1414 bool bVert = false;
1415 bool bVertLRBT = false;
1416 if (GetFrame())
1417 {
1418 bVert = GetFrame()->IsVertical();
1419 bVertLRBT = GetFrame()->IsVertLRBT();
1420 }
1421 nDir = bBidiPor ? 1800_deg10 : UnMapDirection(nDir, bVert, bVertLRBT);
1422
1423 switch ( nDir.get() )
1424 {
1425 case 0 :
1427 break;
1428 case 900 :
1429 OSL_ENSURE( m_aPos.Y() >= GetSize().Width(), "Going underground" );
1430 m_aPos.AdjustY( -(GetSize().Width()) );
1431 break;
1432 case 1800 :
1433 m_aPos.AdjustX( -(GetSize().Width()) );
1434 break;
1435 case 2700 :
1437 break;
1438 }
1439}
1440
1445 : m_aPos( rPoint ), m_nEnd( nEnd ), m_pFont( &rFnt )
1446{
1447};
1448
1450{
1451}
1452
1455 const SwAttrSet &rSet,
1456 const vcl::RenderContext &rOut, sal_Int16 nScript)
1457{
1458 SwFont aFont(&rSet, &rIDocumentSettingAccess);
1459 SwFontScript nActual;
1460 switch (nScript)
1461 {
1462 default:
1463 case i18n::ScriptType::LATIN:
1464 nActual = SwFontScript::Latin;
1465 break;
1466 case i18n::ScriptType::ASIAN:
1467 nActual = SwFontScript::CJK;
1468 break;
1469 case i18n::ScriptType::COMPLEX:
1470 nActual = SwFontScript::CTL;
1471 break;
1472 }
1473 aFont.SetActual(nActual);
1474
1475 vcl::RenderContext &rMutableOut = const_cast<vcl::RenderContext &>(rOut);
1476 const vcl::Font aOldFont(rMutableOut.GetFont());
1477
1478 rMutableOut.SetFont(aFont.GetActualFont());
1479 tools::Long nHeight = rMutableOut.GetTextHeight();
1480
1481 rMutableOut.SetFont(aOldFont);
1482 return nHeight;
1483}
1484
1485/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
Provides access to settings of a document.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
const vcl::Font & GetFont() const
void SetFont(const vcl::Font &rNewFont)
const Color & GetOverlineColor() const
tools::Long GetTextHeight() const
void SetOverlineColor()
const Color & GetTextLineColor() const
void SetTextLineColor()
void DrawStretchText(const Point &rStartPt, sal_Int32 nWidth, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1)
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
SvxCaseMap GetCaseMap() const
const Color & GetValue() const
FontStrikeout GetStrikeout() const
FontEmphasisMark GetEmphasisMark() const
sal_uInt8 & GetProportionalHeight()
sal_uInt32 GetHeight() const
FontFamily GetFamily() const
FontPitch GetPitch() const
const OUString & GetStyleName() const
rtl_TextEncoding GetCharSet() const
const OUString & GetFamilyName() const
bool IsCaseMap() const
bool IsCapital() const
short GetEscapement() const
OUString CalcCaseMap(const OUString &rTxt) const
LanguageType GetLanguage() const
FontItalic GetPosture() const
FontLineStyle GetLineStyle() const
const Color & GetColor() const
Degree10 GetValue() const
bool GetValue() const
FontWeight GetWeight() const
const SvxOverlineItem & GetOverline(bool=true) const
Definition: charatr.hxx:73
const SvxWeightItem & GetCTLWeight(bool=true) const
Definition: charatr.hxx:59
const SvxPostureItem & GetCJKPosture(bool=true) const
Definition: charatr.hxx:51
const SvxFontItem & GetFont(bool=true) const
Definition: charatr.hxx:83
const SvxFontItem & GetCTLFont(bool=true) const
Definition: charatr.hxx:87
const SvxColorItem & GetColor(bool=true) const
Definition: charatr.hxx:89
const SvxKerningItem & GetKerning(bool=true) const
Definition: charatr.hxx:69
const SvxLanguageItem & GetCJKLanguage(bool=true) const
Definition: charatr.hxx:93
const SvxPostureItem & GetCTLPosture(bool=true) const
Definition: charatr.hxx:53
const SvxFontHeightItem & GetSize(bool=true) const
Definition: charatr.hxx:77
const SvxUnderlineItem & GetUnderline(bool=true) const
Definition: charatr.hxx:71
const SvxCharReliefItem & GetCharRelief(bool=true) const
Definition: charatr.hxx:111
const SvxTwoLinesItem & Get2Lines(bool=true) const
Definition: charatr.hxx:105
const SvxLanguageItem & GetLanguage(bool=true) const
Definition: charatr.hxx:91
const SvxFontItem & GetCJKFont(bool=true) const
Definition: charatr.hxx:85
const SvxFontHeightItem & GetCJKSize(bool=true) const
Definition: charatr.hxx:79
const SvxShadowedItem & GetShadowed(bool=true) const
Definition: charatr.hxx:61
const SvxCharHiddenItem & GetCharHidden(bool=true) const
Definition: charatr.hxx:113
const SvxContourItem & GetContour(bool=true) const
Definition: charatr.hxx:67
const SvxEmphasisMarkItem & GetEmphasisMark(bool=true) const
Definition: charatr.hxx:103
const SvxAutoKernItem & GetAutoKern(bool=true) const
Definition: charatr.hxx:63
const SvxWordLineModeItem & GetWordLineMode(bool=true) const
Definition: charatr.hxx:65
const SvxEscapementItem & GetEscapement(bool=true) const
Definition: charatr.hxx:97
const SvxLanguageItem & GetCTLLanguage(bool=true) const
Definition: charatr.hxx:95
const SvxFontHeightItem & GetCTLSize(bool=true) const
Definition: charatr.hxx:81
const SvxCrossedOutItem & GetCrossedOut(bool=true) const
Definition: charatr.hxx:75
const SvxWeightItem & GetCJKWeight(bool=true) const
Definition: charatr.hxx:57
const SvxCaseMapItem & GetCaseMap(bool=true) const
Definition: charatr.hxx:99
const SvxPostureItem & GetPosture(bool=true) const
Definition: charatr.hxx:49
const SvxCharRotateItem & GetCharRotate(bool=true) const
Definition: charatr.hxx:109
const SvxWeightItem & GetWeight(bool=true) const
Definition: charatr.hxx:55
const SvxCharScaleWidthItem & GetCharScaleW(bool=true) const
Definition: charatr.hxx:107
void Lock()
Definition: swcache.cxx:471
const void * GetOwner() const
Definition: swcache.hxx:170
void Unlock()
Definition: swcache.cxx:477
void SetKern(tools::Long nNew)
Definition: drawfont.hxx:533
void SetGreyWave(bool bNew)
Definition: drawfont.hxx:600
TextFrameIndex GetIdx() const
Definition: drawfont.hxx:269
void SetPos(const Point &rNew)
Definition: drawfont.hxx:408
TextFrameIndex GetLen() const
Definition: drawfont.hxx:274
const OUString & GetText() const
Definition: drawfont.hxx:222
void Shift(Degree10 nDir)
Definition: swfont.cxx:1404
bool IsSpaceStop() const
Definition: drawfont.hxx:383
void SetMeasureLen(TextFrameIndex const nNew)
Definition: drawfont.hxx:498
SwViewShell const * GetShell() const
Definition: drawfont.hxx:181
tools::Long GetKern() const
Definition: drawfont.hxx:331
tools::Long GetCharacterSpacing() const
Definition: drawfont.hxx:323
void SetText(const OUString &rNew)
Definition: drawfont.hxx:424
const SwScriptInfo * GetScriptInfo() const
Definition: drawfont.hxx:196
vcl::RenderContext & GetOut() const
Definition: drawfont.hxx:186
void SetWidth(sal_uInt16 nNew)
Definition: drawfont.hxx:520
TextFrameIndex GetMeasureLen() const
Definition: drawfont.hxx:279
SwFont * GetFont() const
Definition: drawfont.hxx:256
bool ApplyAutoColor(vcl::Font *pFnt=nullptr)
Definition: fntcache.cxx:2140
void SetIdx(TextFrameIndex const nNew)
Definition: drawfont.hxx:486
SwUnderlineFont * GetUnderFnt() const
Definition: drawfont.hxx:264
vcl::RenderContext * GetpOut() const
Definition: drawfont.hxx:191
void SetTextIdxLen(const OUString &rNewStr, TextFrameIndex const nNewIdx, TextFrameIndex const nNewLen)
Definition: drawfont.hxx:432
const SwTextFrame * GetFrame() const
Definition: drawfont.hxx:171
void SetLen(TextFrameIndex const nNew)
Definition: drawfont.hxx:492
sal_uInt16 GetWidth() const
Definition: drawfont.hxx:305
const Point & GetPos() const
Definition: drawfont.hxx:201
const Size & GetSize() const
Definition: drawfont.hxx:248
void SetUnderFnt(SwUnderlineFont *pULFnt)
Definition: drawfont.hxx:579
tools::Long GetSpace() const
Definition: drawfont.hxx:336
SwFntObj * Get()
Definition: fntcache.hxx:141
sal_uInt16 GetFontHeight(const SwViewShell *pSh, const OutputDevice &rOut)
Definition: fntcache.cxx:307
void SetDevFont(const SwViewShell *pSh, OutputDevice &rOut)
Definition: fntcache.cxx:568
TextFrameIndex GetModelPositionForViewPoint(SwDrawTextInfo &rInf)
Definition: fntcache.cxx:1682
sal_uInt16 GetFontAscent(const SwViewShell *pSh, const OutputDevice &rOut)
Definition: fntcache.cxx:269
void DrawText(SwDrawTextInfo &rInf)
Definition: fntcache.cxx:769
sal_uInt16 GetFontHangingBaseline(const SwViewShell *pSh, const OutputDevice &rOut)
Definition: fntcache.cxx:397
bool IsSymbol() const
Definition: fntcache.hxx:110
Size GetTextSize(SwDrawTextInfo &rInf)
determine the TextSize (of the printer)
Definition: fntcache.cxx:1538
To take Asian or other languages into consideration, an SwFont object consists of 3 SwSubFonts (Latin...
Definition: swfont.hxx:135
void DrawStretchText_(SwDrawTextInfo &rInf)
Definition: swfont.hxx:324
void SetOverline(const FontLineStyle eOverline)
Definition: swfont.hxx:567
void Invalidate()
Definition: swfont.hxx:338
void ChgFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.hxx:180
sal_uInt8 m_nRefCount
Definition: swfont.hxx:163
void SetPropWidth(const sal_uInt16 nNew)
Definition: swfont.hxx:700
void SetBottomBorder(const editeng::SvxBorderLine *pBottomBorder)
Definition: swfont.cxx:84
Color m_aUnderColor
Definition: swfont.hxx:143
std::optional< Color > mxBackColor
Definition: swfont.hxx:141
void SetShadowLocation(const SvxShadowLocation aLocation)
Definition: swfont.hxx:944
std::optional< editeng::SvxBorderLine > m_aLeftBorder
Definition: swfont.hxx:150
bool m_bPaintBlank
Definition: swfont.hxx:171
void SetStrikeout(const FontStrikeout eStrikeout)
Definition: swfont.hxx:582
void SetHighlightColor(const Color &aNewColor)
Definition: swfont.hxx:951
bool m_bFontChg
Definition: swfont.hxx:172
SvxShadowLocation GetAbsShadowLocation(const bool bVertLayout, const bool bVertLayoutLRBT) const
Get the absolute shadow location dependent from orientation.
Definition: swfont.cxx:199
void SetDiffFnt(const SfxItemSet *pSet, const IDocumentSettingAccess *pIDocumentSettingAccess)
Definition: swfont.cxx:473
void SetEscapement(const short nNewEsc)
Definition: swfont.hxx:791
void SetVertical(Degree10 nDir, const bool bVertLayout=false, const bool bVertLayoutLRBT=false)
Definition: swfont.cxx:417
SwFontScript m_nActual
Definition: swfont.hxx:168
o3tl::enumarray< SwFontScript, SwSubFont > m_aSub
Definition: swfont.hxx:138
Degree10 GetOrientation(const bool bVertLayout=false, const bool bVertFormatLRBT=false) const
Definition: swfont.cxx:412
void SetAlign(const TextAlign eAlign)
Definition: swfont.hxx:524
void SetLeftBorder(const editeng::SvxBorderLine *pLeftBorder)
Definition: swfont.cxx:110
void SetUnderColor(const Color &rColor)
Definition: swfont.hxx:219
void SetEmphasisMark(const FontEmphasisMark eValue)
Definition: swfont.hxx:692
Color m_aShadowColor
Definition: swfont.hxx:158
~SwFont()
Definition: swfont.cxx:824
void SetProportion(const sal_uInt8 nNewPropr)
Definition: swfont.hxx:772
std::optional< editeng::SvxBorderLine > m_aBottomBorder
Definition: swfont.hxx:148
void SetTopBorderDist(const sal_uInt16 nTopDist)
Definition: swfont.hxx:837
SwFont(const SwAttrSet *pSet, const IDocumentSettingAccess *pIDocumentSettingAccess)
Definition: swfont.cxx:673
sal_uInt16 CalcShadowSpace(const SvxShadowItemSide nShadow, const bool bVertLayout, const bool bVertLayoutLRBT, const bool bSkipLeft, const bool bSkipRight) const
Calculate the shadow space on the specified side dependent from the orientation and connection with n...
Definition: swfont.cxx:282
void SetBackColor(std::optional< Color > xNewColor)
Definition: swfont.cxx:64
void SetOutline(const bool bOutline)
Definition: swfont.hxx:610
SwFont & operator=(const SwFont &rFont)
Definition: swfont.cxx:828
SvxShadowLocation m_aShadowLocation
Definition: swfont.hxx:160
const SvxFont & GetActualFont() const
Definition: swfont.hxx:189
sal_uInt16 m_nTopBorderDist
Definition: swfont.hxx:153
sal_uInt16 m_nShadowWidth
Definition: swfont.hxx:159
void SetLeftBorderDist(const sal_uInt16 nLeftDist)
Definition: swfont.hxx:858
const std::optional< editeng::SvxBorderLine > & GetAbsLeftBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
Definition: swfont.cxx:162
const Color & GetUnderColor() const
Definition: swfont.hxx:276
SwFontScript GetActual() const
Definition: swfont.hxx:187
void SetRightBorderDist(const sal_uInt16 nRightDist)
Definition: swfont.hxx:851
void SetRightBorder(const editeng::SvxBorderLine *pRightBorder)
Definition: swfont.cxx:97
void SetShadow(const bool bShadow)
Definition: swfont.hxx:625
sal_uInt16 m_nRightBorderDist
Definition: swfont.hxx:155
const std::optional< editeng::SvxBorderLine > & GetAbsTopBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
Definition: swfont.cxx:124
void AllocFontCacheId(SwViewShell const *pSh, SwFontScript nWhich)
Definition: swfont.cxx:864
sal_uInt16 m_nBottomBorderDist
Definition: swfont.hxx:154
Color m_aOverColor
Definition: swfont.hxx:144
void SetColor(const Color &rColor)
Definition: swfont.hxx:421
Color m_aHighlightColor
Definition: swfont.hxx:142
bool m_bGreyWave
Definition: swfont.hxx:174
void SetTopBorder(const editeng::SvxBorderLine *pTopBorder)
Definition: swfont.cxx:71
sal_uInt8 m_nContentControlCount
Definition: swfont.hxx:165
std::optional< editeng::SvxBorderLine > m_aRightBorder
Definition: swfont.hxx:149
LanguageType GetLanguage() const
Definition: swfont.hxx:286
void SetTransparent(const bool bTrans)
Definition: swfont.hxx:650
void SetAutoKern(FontKerning nAutoKern)
Definition: swfont.hxx:640
const std::optional< editeng::SvxBorderLine > & GetAbsBottomBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
Definition: swfont.cxx:143
sal_uInt8 m_nMetaCount
Definition: swfont.hxx:164
void SetOverColor(const Color &rColor)
Definition: swfont.hxx:221
void SetUnderline(const FontLineStyle eUnderline)
Definition: swfont.hxx:552
void SetCaseMap(const SvxCaseMap eNew)
Definition: swfont.hxx:664
void SetShadowColor(const Color &rColor)
Definition: swfont.hxx:930
void SetWordLineMode(const bool bWordLineMode)
Definition: swfont.hxx:678
bool m_bOrgChg
Definition: swfont.hxx:173
void SetShadowWidth(const sal_uInt16 nWidth)
Definition: swfont.hxx:937
void ChgPhysFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.cxx:893
void SetRelief(const FontRelief eNew)
Definition: swfont.hxx:718
sal_uInt8 m_nInputFieldCount
Definition: swfont.hxx:166
sal_uInt16 m_nLeftBorderDist
Definition: swfont.hxx:156
const std::optional< editeng::SvxBorderLine > & GetAbsRightBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
Definition: swfont.cxx:181
void SetFixKerning(const short nNewKern)
Definition: swfont.hxx:657
std::optional< editeng::SvxBorderLine > m_aTopBorder
Definition: swfont.hxx:147
const Color & GetOverColor() const
Definition: swfont.hxx:278
void SetActual(SwFontScript nNew)
Definition: swfont.hxx:754
void SetBottomBorderDist(const sal_uInt16 nBottomDist)
Definition: swfont.hxx:844
sal_uInt8 m_nToxCount
Definition: swfont.hxx:162
bool IsVertLRBT() const
Definition: frame.hxx:989
bool IsRightToLeft() const
Definition: frame.hxx:993
bool IsVertical() const
Definition: frame.hxx:979
sal_Int16 ScriptType(const TextFrameIndex nPos) const
Definition: porlay.cxx:1871
const void * m_nFontCacheId
Definition: swfont.hxx:56
sal_uInt16 GetHangingBaseline(SwViewShell const *pSh, const OutputDevice &rOut)
Definition: swfont.cxx:968
short CheckKerning()
Definition: swfont.hxx:113
bool ChgFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.cxx:876
void CalcEsc(SwDrawTextInfo const &rInf, Point &rPos)
Definition: swfont.cxx:1333
sal_uInt16 m_nFontIndex
Definition: swfont.hxx:58
Size GetTextSize_(SwDrawTextInfo &rInf)
Definition: swfont.cxx:974
void DrawCapital(SwDrawTextInfo &rInf)
Definition: fntcap.cxx:322
sal_uInt16 GetAscent(SwViewShell const *pSh, const OutputDevice &rOut)
Definition: swfont.cxx:948
Size GetCapitalSize(SwDrawTextInfo &rInf)
Definition: fntcap.cxx:139
sal_uInt16 m_nOrgAscent
Definition: swfont.hxx:60
sal_uInt16 GetHeight(SwViewShell const *pSh, const OutputDevice &rOut)
Definition: swfont.cxx:955
TextFrameIndex GetCapitalCursorOfst(SwDrawTextInfo &rInf)
Definition: fntcap.cxx:403
bool IsSymbol(SwViewShell const *pSh)
Definition: swfont.cxx:870
void SetUnderline(const FontLineStyle eUnderline)
Definition: swfont.hxx:546
TextFrameIndex GetModelPositionForViewPoint_(SwDrawTextInfo &rInf)
Definition: swfont.cxx:1300
void DrawStretchCapital(SwDrawTextInfo &rInf)
Definition: fntcap.cxx:477
sal_uInt16 m_nOrgHeight
Definition: swfont.hxx:59
sal_uInt16 CalcEscHeight(const sal_uInt16 nOldHeight, const sal_uInt16 nOldAscent) const
Definition: swfont.cxx:923
void DrawText_(SwDrawTextInfo &rInf, const bool bGrey)
Definition: swfont.cxx:1093
sal_uInt16 CalcEscAscent(const sal_uInt16 nOldAscent) const
Definition: swfont.cxx:460
short CheckKerning_()
Definition: swfont.cxx:939
void DrawStretchText_(SwDrawTextInfo &rInf)
Definition: swfont.cxx:1222
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
Definition: txtfrm.cxx:683
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout.
Definition: txtfrm.cxx:473
const Point & GetPos() const
Definition: swfont.hxx:977
SwFont & GetFont()
Definition: swfont.hxx:972
SwUnderlineFont(SwFont &rFnt, TextFrameIndex nEnd, const Point &rPoint)
Definition: swfont.cxx:1444
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define DFLT_ESC_AUTO_SUB
#define DFLT_ESC_AUTO_SUPER
SwFntObj * pLastFont
Definition: fntcache.cxx:68
FontLineStyle
LINESTYLE_NONE
LINESTYLE_DOTTED
STRIKEOUT_NONE
ALIGN_BASELINE
constexpr OUStringLiteral CH_TXT_ATR_SUBST_FIELDSTART
Definition: hintids.hxx:186
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
constexpr TypedWhichId< SvxCrossedOutItem > RES_CHRATR_CROSSEDOUT(5)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
constexpr TypedWhichId< SvxAutoKernItem > RES_CHRATR_AUTOKERN(17)
constexpr TypedWhichId< SvxShadowItem > RES_CHRATR_SHADOW(41)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
constexpr TypedWhichId< SvxShadowedItem > RES_CHRATR_SHADOWED(13)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_HIGHLIGHT(42)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CTL_WEIGHT(31)
constexpr TypedWhichId< SvxContourItem > RES_CHRATR_CONTOUR(4)
constexpr TypedWhichId< SvxCharReliefItem > RES_CHRATR_RELIEF(36)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr TypedWhichId< SvxEscapementItem > RES_CHRATR_ESCAPEMENT(6)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
constexpr TypedWhichId< SvxCaseMapItem > RES_CHRATR_CASEMAP(RES_CHRATR_BEGIN)
constexpr OUStringLiteral CH_TXT_ATR_SUBST_FIELDEND
Definition: hintids.hxx:187
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CTL_POSTURE(30)
constexpr TypedWhichId< SvxEmphasisMarkItem > RES_CHRATR_EMPHASIS_MARK(33)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
constexpr TypedWhichId< SvxOverlineItem > RES_CHRATR_OVERLINE(38)
constexpr TypedWhichId< SvxCharRotateItem > RES_CHRATR_ROTATE(32)
constexpr TypedWhichId< SvxWordLineModeItem > RES_CHRATR_WORDLINEMODE(16)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
constexpr TypedWhichId< SvxKerningItem > RES_CHRATR_KERNING(9)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
constexpr TypedWhichId< SvxTwoLinesItem > RES_CHRATR_TWO_LINES(34)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
constexpr TypedWhichId< SvxBoxItem > RES_CHRATR_BOX(40)
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
#define CH_TXT_ATR_FIELDEND
Definition: hintids.hxx:185
#define CH_TXT_ATR_FIELDSTART
Definition: hintids.hxx:183
#define SAL_WARN(area, stream)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
#define SPACING_PRECISION_FACTOR
Definition: scriptinfo.hxx:41
SvxShadowItemSide
static SfxItemSet & rSet
UNDERLYING_TYPE get() const
SvxShadowLocation
static Degree10 MapDirection(Degree10 nDir, const bool bVertFormat, const bool bVertFormatLRBT)
Definition: swfont.cxx:343
tools::Long AttrSetToLineHeight(const IDocumentSettingAccess &rIDocumentSettingAccess, const SwAttrSet &rSet, const vcl::RenderContext &rOut, sal_Int16 nScript)
Helper for filters to find true lineheight of a font.
Definition: swfont.cxx:1454
SvStatistics g_SvStat
Definition: swfont.cxx:58
Degree10 UnMapDirection(Degree10 nDir, const bool bVertFormat, const bool bVertFormatLRBT)
Definition: swfont.cxx:373
const sal_Unicode CH_BLANK
Definition: swfont.hxx:42
SwFontScript
Definition: swfont.hxx:124
#define SV_STAT(nWhich)
Definition: swfont.hxx:1001
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
unsigned char sal_uInt8