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>
30 #include <editeng/autokernitem.hxx>
31 #include <editeng/shdditem.hxx>
33 #include <editeng/contouritem.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>
44 #include <editeng/twolinesitem.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 
61 using namespace ::com::sun::star;
62 
63 // set background brush, depending on character formatting
64 void 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();
78  m_nTopBorderDist = 0;
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 
84 void SwFont::SetBottomBorder( const editeng::SvxBorderLine* pBottomBorder )
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();
104  m_nRightBorderDist = 0;
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();
117  m_nLeftBorderDist = 0;
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 
123 const std::optional<editeng::SvxBorderLine>&
124 SwFont::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 
142 const std::optional<editeng::SvxBorderLine>&
143 SwFont::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 
161 const std::optional<editeng::SvxBorderLine>&
162 SwFont::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 
180 const std::optional<editeng::SvxBorderLine>&
181 SwFont::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 
282 sal_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
343 static 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
373 Degree10 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 
412 Degree10 SwFont::GetOrientation(const bool bVertFormat, const bool bVertFormatLRBT) const
413 {
414  return UnMapDirection(m_aSub[m_nActual].GetOrientation(), bVertFormat, bVertFormatLRBT);
415 }
416 
417 void 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 
422  if( nDir != m_aSub[SwFontScript::Latin].GetOrientation() )
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
460 sal_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 
473 void 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 
643 SwFont::SwFont( const SwFont &rFont )
644  : m_aSub(rFont.m_aSub)
645 {
646  m_nActual = rFont.m_nActual;
647  mxBackColor = rFont.mxBackColor;
649  m_aTopBorder = rFont.m_aTopBorder;
660  m_aUnderColor = rFont.GetUnderColor();
661  m_aOverColor = rFont.GetOverColor();
662  m_nToxCount = 0;
663  m_nRefCount = 0;
664  m_nMetaCount = 0;
666  m_nInputFieldCount = 0;
667  m_bFontChg = rFont.m_bFontChg;
668  m_bOrgChg = rFont.m_bOrgChg;
670  m_bGreyWave = rFont.m_bGreyWave;
671 }
672 
673 SwFont::SwFont( const SwAttrSet* pAttrSet,
674  const IDocumentSettingAccess* pIDocumentSettingAccess )
675  : m_aSub()
676 {
678  m_nToxCount = 0;
679  m_nRefCount = 0;
680  m_nMetaCount = 0;
682  m_nInputFieldCount = 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() )
766  SetProportion( rEsc.GetProportionalHeight() );
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);
792  SetTopBorderDist(0);
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  {
807  SetShadowWidth(0);
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;
838  m_aTopBorder = rFont.m_aTopBorder;
849  m_aUnderColor = rFont.GetUnderColor();
850  m_aOverColor = rFont.GetOverColor();
851  m_nToxCount = 0;
852  m_nRefCount = 0;
853  m_nMetaCount = 0;
855  m_nInputFieldCount = 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 
876 bool SwSubFont::ChgFnt( SwViewShell const *pSh, OutputDevice& rOut )
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 
893 void SwFont::ChgPhysFnt( SwViewShell const *pSh, OutputDevice& rOut )
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)
923 sal_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 
948 sal_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 
955 sal_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 
968 sal_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...
978  if ( !pLastFont || pLastFont->GetOwner() != reinterpret_cast<const void*>(m_nFontCacheId) ||
979  !IsSameInstance( rInf.GetpOut()->GetFont() ) )
980  ChgFnt( rInf.GetShell(), rInf.GetOut() );
981 
982  SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
983 
984  Size aTextSize;
985  TextFrameIndex const nLn = rInf.GetLen() == TextFrameIndex(COMPLETE_STRING)
986  ? TextFrameIndex(rInf.GetText().getLength())
987  : rInf.GetLen();
988  rInf.SetLen( nLn );
989  if( IsCapital() && nLn )
990  aTextSize = GetCapitalSize( rInf );
991  else
992  {
993  SV_STAT( nGetTextSize );
994  tools::Long nOldKern = rInf.GetKern();
995  const OUString oldText = rInf.GetText();
996  rInf.SetKern( CheckKerning() );
997  if ( !IsCaseMap() )
998  aTextSize = pLastFont->GetTextSize( rInf );
999  else
1000  {
1001  const OUString aTmp = CalcCaseMap( rInf.GetText() );
1002  const OUString oldStr = rInf.GetText();
1003  bool bCaseMapLengthDiffers(aTmp.getLength() != oldStr.getLength());
1004 
1005  if(bCaseMapLengthDiffers && rInf.GetLen())
1006  {
1007  // If the length of the original string and the CaseMapped one
1008  // are different, it is necessary to handle the given text part as
1009  // a single snippet since its size may differ, too.
1010  TextFrameIndex const nOldIdx(rInf.GetIdx());
1011  TextFrameIndex const nOldLen(rInf.GetLen());
1012  const OUString aSnippet(oldStr.copy(sal_Int32(nOldIdx), sal_Int32(nOldLen)));
1013  const OUString aNewText(CalcCaseMap(aSnippet));
1014 
1015  rInf.SetText( aNewText );
1016  rInf.SetIdx( TextFrameIndex(0) );
1017  rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
1018 
1019  aTextSize = pLastFont->GetTextSize( rInf );
1020 
1021  rInf.SetIdx( nOldIdx );
1022  rInf.SetLen( nOldLen );
1023  }
1024  else
1025  {
1026  rInf.SetText( aTmp );
1027  aTextSize = pLastFont->GetTextSize( rInf );
1028  }
1029 
1030  rInf.SetText(oldStr);
1031  }
1032  rInf.SetKern( nOldKern );
1033  rInf.SetText(oldText);
1034  // A word that's longer than one line, with escapement at the line
1035  // break, must report its effective height.
1036  if( GetEscapement() )
1037  {
1038  const sal_uInt16 nAscent = pLastFont->GetFontAscent( rInf.GetShell(),
1039  rInf.GetOut() );
1040  aTextSize.setHeight(
1041  static_cast<tools::Long>(CalcEscHeight( o3tl::narrowing<sal_uInt16>(aTextSize.Height()), nAscent)) );
1042  }
1043  }
1044 
1045  if (TextFrameIndex(1) == rInf.GetLen()
1046  && CH_TXT_ATR_FIELDSTART == rInf.GetText()[sal_Int32(rInf.GetIdx())])
1047  {
1048  assert(!"this is presumably dead code");
1049  TextFrameIndex const nOldIdx(rInf.GetIdx());
1050  TextFrameIndex const nOldLen(rInf.GetLen());
1051  const OUString aNewText(CH_TXT_ATR_SUBST_FIELDSTART);
1052  rInf.SetText( aNewText );
1053  rInf.SetIdx( TextFrameIndex(0) );
1054  rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
1055  aTextSize = pLastFont->GetTextSize( rInf );
1056  rInf.SetIdx( nOldIdx );
1057  rInf.SetLen( nOldLen );
1058  }
1059  else if (TextFrameIndex(1) == rInf.GetLen()
1060  && CH_TXT_ATR_FIELDEND == rInf.GetText()[sal_Int32(rInf.GetIdx())])
1061  {
1062  assert(!"this is presumably dead code");
1063  TextFrameIndex const nOldIdx(rInf.GetIdx());
1064  TextFrameIndex const nOldLen(rInf.GetLen());
1065  const OUString aNewText(CH_TXT_ATR_SUBST_FIELDEND);
1066  rInf.SetText( aNewText );
1067  rInf.SetIdx( TextFrameIndex(0) );
1068  rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
1069  aTextSize = pLastFont->GetTextSize( rInf );
1070  rInf.SetIdx( nOldIdx );
1071  rInf.SetLen( nOldLen );
1072  }
1073 
1074  return aTextSize;
1075 }
1076 
1077 void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey )
1078 {
1079  rInf.SetGreyWave( bGrey );
1080  TextFrameIndex const nLn(rInf.GetText().getLength());
1081  if( !rInf.GetLen() || !nLn )
1082  return;
1083  if (TextFrameIndex(COMPLETE_STRING) == rInf.GetLen())
1084  rInf.SetLen( nLn );
1085 
1086  FontLineStyle nOldUnder = LINESTYLE_NONE;
1087  SwUnderlineFont* pUnderFnt = nullptr;
1088 
1089  if( rInf.GetUnderFnt() )
1090  {
1091  nOldUnder = GetUnderline();
1093  pUnderFnt = rInf.GetUnderFnt();
1094  }
1095 
1096  if( !pLastFont || pLastFont->GetOwner() != reinterpret_cast<const void*>(m_nFontCacheId) )
1097  ChgFnt( rInf.GetShell(), rInf.GetOut() );
1098 
1099  SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
1100 
1101  const Point aOldPos(rInf.GetPos());
1102  Point aPos( rInf.GetPos() );
1103 
1104  if( GetEscapement() )
1105  CalcEsc( rInf, aPos );
1106 
1107  rInf.SetPos( aPos );
1109 
1110  if( IsCapital() )
1111  DrawCapital( rInf );
1112  else
1113  {
1114  SV_STAT( nDrawText );
1115  if ( !IsCaseMap() )
1116  pLastFont->DrawText( rInf );
1117  else
1118  {
1119  const OUString oldStr = rInf.GetText();
1120  const OUString aString( CalcCaseMap(oldStr) );
1121  bool bCaseMapLengthDiffers(aString.getLength() != oldStr.getLength());
1122 
1123  if(bCaseMapLengthDiffers && rInf.GetLen())
1124  {
1125  // If the length of the original string and the CaseMapped one
1126  // are different, it is necessary to handle the given text part as
1127  // a single snippet since its size may differ, too.
1128  TextFrameIndex const nOldIdx(rInf.GetIdx());
1129  TextFrameIndex const nOldLen(rInf.GetLen());
1130  const OUString aSnippet(oldStr.copy(sal_Int32(nOldIdx), sal_Int32(nOldLen)));
1131  const OUString aNewText = CalcCaseMap(aSnippet);
1132 
1133  rInf.SetText( aNewText );
1134  rInf.SetIdx( TextFrameIndex(0) );
1135  rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
1136 
1137  pLastFont->DrawText( rInf );
1138 
1139  rInf.SetIdx( nOldIdx );
1140  rInf.SetLen( nOldLen );
1141  }
1142  else
1143  {
1144  rInf.SetText( aString );
1145  pLastFont->DrawText( rInf );
1146  }
1147 
1148  rInf.SetText(oldStr);
1149  }
1150  }
1151 
1152  if( pUnderFnt && nOldUnder != LINESTYLE_NONE )
1153  {
1154  Size aFontSize = GetTextSize_( rInf );
1155  const OUString oldStr = rInf.GetText();
1156 
1157  TextFrameIndex const nOldIdx = rInf.GetIdx();
1158  TextFrameIndex const nOldLen = rInf.GetLen();
1159  tools::Long nSpace = 0;
1160  if( rInf.GetSpace() )
1161  {
1162  TextFrameIndex nTmpEnd = nOldIdx + nOldLen;
1163  if (nTmpEnd > TextFrameIndex(oldStr.getLength()))
1164  nTmpEnd = TextFrameIndex(oldStr.getLength());
1165 
1166  const SwScriptInfo* pSI = rInf.GetScriptInfo();
1167 
1168  const bool bAsianFont =
1169  ( rInf.GetFont() && SwFontScript::CJK == rInf.GetFont()->GetActual() );
1170  for (TextFrameIndex nTmp = nOldIdx; nTmp < nTmpEnd; ++nTmp)
1171  {
1172  if (CH_BLANK == oldStr[sal_Int32(nTmp)] || bAsianFont ||
1173  (nTmp + TextFrameIndex(1) < TextFrameIndex(oldStr.getLength())
1174  && pSI
1175  && i18n::ScriptType::ASIAN == pSI->ScriptType(nTmp + TextFrameIndex(1))))
1176  {
1177  ++nSpace;
1178  }
1179  }
1180 
1181  // if next portion if a hole portion we do not consider any
1182  // extra space added because the last character was ASIAN
1183  if ( nSpace && rInf.IsSpaceStop() && bAsianFont )
1184  --nSpace;
1185 
1186  nSpace *= rInf.GetSpace() / SPACING_PRECISION_FACTOR;
1187  }
1188 
1189  rInf.SetWidth( sal_uInt16(aFontSize.Width() + nSpace) );
1190  rInf.SetTextIdxLen( " ", TextFrameIndex(0), TextFrameIndex(2) );
1191  SetUnderline( nOldUnder );
1192  rInf.SetUnderFnt( nullptr );
1193 
1194  // set position for underline font
1195  rInf.SetPos( pUnderFnt->GetPos() );
1196 
1197  pUnderFnt->GetFont().DrawStretchText_( rInf );
1198 
1199  rInf.SetUnderFnt( pUnderFnt );
1200  rInf.SetTextIdxLen(oldStr, nOldIdx, nOldLen);
1201  }
1202 
1203  rInf.SetPos(aOldPos);
1204 }
1205 
1207 {
1208  if( !rInf.GetLen() || !rInf.GetText().getLength() )
1209  return;
1210 
1211  FontLineStyle nOldUnder = LINESTYLE_NONE;
1212  SwUnderlineFont* pUnderFnt = nullptr;
1213 
1214  if( rInf.GetUnderFnt() )
1215  {
1216  nOldUnder = GetUnderline();
1218  pUnderFnt = rInf.GetUnderFnt();
1219  }
1220 
1221  if ( !pLastFont || pLastFont->GetOwner() != reinterpret_cast<const void*>(m_nFontCacheId) )
1222  ChgFnt( rInf.GetShell(), rInf.GetOut() );
1223 
1224  SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
1225 
1226  rInf.ApplyAutoColor();
1227 
1228  const Point aOldPos(rInf.GetPos());
1229  Point aPos( rInf.GetPos() );
1230 
1231  if( GetEscapement() )
1232  CalcEsc( rInf, aPos );
1233 
1235  rInf.SetPos( aPos );
1236 
1237  if( IsCapital() )
1238  DrawStretchCapital( rInf );
1239  else
1240  {
1241  SV_STAT( nDrawStretchText );
1242 
1243  if ( rInf.GetFrame() )
1244  {
1245  if ( rInf.GetFrame()->IsRightToLeft() )
1246  rInf.GetFrame()->SwitchLTRtoRTL( aPos );
1247 
1248  if ( rInf.GetFrame()->IsVertical() )
1249  rInf.GetFrame()->SwitchHorizontalToVertical( aPos );
1250 
1251  rInf.SetPos( aPos );
1252  }
1253 
1254  if ( !IsCaseMap() )
1255  rInf.GetOut().DrawStretchText( aPos, rInf.GetWidth(),
1256  rInf.GetText(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
1257  else
1258  rInf.GetOut().DrawStretchText( aPos, rInf.GetWidth(),
1259  CalcCaseMap(rInf.GetText()),
1260  sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
1261  }
1262 
1263  if( pUnderFnt && nOldUnder != LINESTYLE_NONE )
1264  {
1265  const OUString oldStr = rInf.GetText();
1266  TextFrameIndex const nOldIdx = rInf.GetIdx();
1267  TextFrameIndex const nOldLen = rInf.GetLen();
1268  rInf.SetTextIdxLen( " ", TextFrameIndex(0), TextFrameIndex(2) );
1269  SetUnderline( nOldUnder );
1270  rInf.SetUnderFnt( nullptr );
1271 
1272  // set position for underline font
1273  rInf.SetPos( pUnderFnt->GetPos() );
1274 
1275  pUnderFnt->GetFont().DrawStretchText_( rInf );
1276 
1277  rInf.SetUnderFnt( pUnderFnt );
1278  rInf.SetTextIdxLen(oldStr, nOldIdx, nOldLen);
1279  }
1280 
1281  rInf.SetPos(aOldPos);
1282 }
1283 
1285 {
1286  if ( !pLastFont || pLastFont->GetOwner() != reinterpret_cast<const void*>(m_nFontCacheId) )
1287  ChgFnt( rInf.GetShell(), rInf.GetOut() );
1288 
1289  SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
1290 
1291  TextFrameIndex const nLn = rInf.GetLen() == TextFrameIndex(COMPLETE_STRING)
1292  ? TextFrameIndex(rInf.GetText().getLength())
1293  : rInf.GetLen();
1294  rInf.SetLen( nLn );
1295  TextFrameIndex nCursor(0);
1296  if( IsCapital() && nLn )
1297  nCursor = GetCapitalCursorOfst( rInf );
1298  else
1299  {
1300  const OUString oldText = rInf.GetText();
1301  tools::Long nOldKern = rInf.GetKern();
1302  rInf.SetKern( CheckKerning() );
1303  SV_STAT( nGetTextSize );
1304  if ( !IsCaseMap() )
1305  nCursor = pLastFont->GetModelPositionForViewPoint( rInf );
1306  else
1307  {
1308  rInf.SetText( CalcCaseMap( rInf.GetText() ) );
1309  nCursor = pLastFont->GetModelPositionForViewPoint( rInf );
1310  }
1311  rInf.SetKern( nOldKern );
1312  rInf.SetText(oldText);
1313  }
1314  return nCursor;
1315 }
1316 
1317 void SwSubFont::CalcEsc( SwDrawTextInfo const & rInf, Point& rPos )
1318 {
1319  tools::Long nOfst;
1320 
1321  bool bVert = false;
1322  bool bVertLRBT = false;
1323  if (rInf.GetFrame())
1324  {
1325  bVert = rInf.GetFrame()->IsVertical();
1326  bVertLRBT = rInf.GetFrame()->IsVertLRBT();
1327  }
1328  const Degree10 nDir = UnMapDirection(GetOrientation(), bVert, bVertLRBT);
1329 
1330  switch ( GetEscapement() )
1331  {
1332  case DFLT_ESC_AUTO_SUB :
1333  nOfst = m_nOrgHeight - m_nOrgAscent -
1334  pLastFont->GetFontHeight( rInf.GetShell(), rInf.GetOut() ) +
1335  pLastFont->GetFontAscent( rInf.GetShell(), rInf.GetOut() );
1336 
1337  switch ( nDir.get() )
1338  {
1339  case 0 :
1340  rPos.AdjustY(nOfst );
1341  break;
1342  case 900 :
1343  rPos.AdjustX(nOfst );
1344  break;
1345  case 2700 :
1346  rPos.AdjustX( -nOfst );
1347  break;
1348  }
1349 
1350  break;
1351  case DFLT_ESC_AUTO_SUPER :
1352  nOfst = pLastFont->GetFontAscent( rInf.GetShell(), rInf.GetOut() ) -
1353  m_nOrgAscent;
1354 
1355  switch ( nDir.get() )
1356  {
1357  case 0 :
1358  rPos.AdjustY(nOfst );
1359  break;
1360  case 900 :
1361  rPos.AdjustX(nOfst );
1362  break;
1363  case 2700 :
1364  rPos.AdjustX( -nOfst );
1365  break;
1366  }
1367 
1368  break;
1369  default :
1370  nOfst = (static_cast<tools::Long>(m_nOrgHeight) * GetEscapement()) / 100;
1371 
1372  switch ( nDir.get() )
1373  {
1374  case 0 :
1375  rPos.AdjustY( -nOfst );
1376  break;
1377  case 900 :
1378  rPos.AdjustX( -nOfst );
1379  break;
1380  case 2700 :
1381  rPos.AdjustX(nOfst );
1382  break;
1383  }
1384  }
1385 }
1386 
1387 // used during painting of small capitals
1389 {
1390 #ifdef DBG_UTIL
1391  OSL_ENSURE( m_bPos, "DrawTextInfo: Undefined Position" );
1392  OSL_ENSURE( m_bSize, "DrawTextInfo: Undefined Width" );
1393 #endif
1394 
1395  const bool bBidiPor = ( GetFrame() && GetFrame()->IsRightToLeft() ) !=
1397 
1398  bool bVert = false;
1399  bool bVertLRBT = false;
1400  if (GetFrame())
1401  {
1402  bVert = GetFrame()->IsVertical();
1403  bVertLRBT = GetFrame()->IsVertLRBT();
1404  }
1405  nDir = bBidiPor ? 1800_deg10 : UnMapDirection(nDir, bVert, bVertLRBT);
1406 
1407  switch ( nDir.get() )
1408  {
1409  case 0 :
1410  m_aPos.AdjustX(GetSize().Width() );
1411  break;
1412  case 900 :
1413  OSL_ENSURE( m_aPos.Y() >= GetSize().Width(), "Going underground" );
1414  m_aPos.AdjustY( -(GetSize().Width()) );
1415  break;
1416  case 1800 :
1417  m_aPos.AdjustX( -(GetSize().Width()) );
1418  break;
1419  case 2700 :
1420  m_aPos.AdjustY(GetSize().Width() );
1421  break;
1422  }
1423 }
1424 
1428 SwUnderlineFont::SwUnderlineFont(SwFont& rFnt, TextFrameIndex const nEnd, const Point& rPoint)
1429  : m_aPos( rPoint ), m_nEnd( nEnd ), m_pFont( &rFnt )
1430 {
1431 };
1432 
1434 {
1435 }
1436 
1439  const SwAttrSet &rSet,
1440  const vcl::RenderContext &rOut, sal_Int16 nScript)
1441 {
1442  SwFont aFont(&rSet, &rIDocumentSettingAccess);
1443  SwFontScript nActual;
1444  switch (nScript)
1445  {
1446  default:
1447  case i18n::ScriptType::LATIN:
1448  nActual = SwFontScript::Latin;
1449  break;
1450  case i18n::ScriptType::ASIAN:
1451  nActual = SwFontScript::CJK;
1452  break;
1453  case i18n::ScriptType::COMPLEX:
1454  nActual = SwFontScript::CTL;
1455  break;
1456  }
1457  aFont.SetActual(nActual);
1458 
1459  vcl::RenderContext &rMutableOut = const_cast<vcl::RenderContext &>(rOut);
1460  const vcl::Font aOldFont(rMutableOut.GetFont());
1461 
1462  rMutableOut.SetFont(aFont.GetActualFont());
1463  tools::Long nHeight = rMutableOut.GetTextHeight();
1464 
1465  rMutableOut.SetFont(aOldFont);
1466  return nHeight;
1467 }
1468 
1469 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetLeftBorderDist(const sal_uInt16 nLeftDist)
Definition: swfont.hxx:855
const SvxFontItem & GetCTLFont(bool=true) const
Definition: charatr.hxx:87
SwFntObj * pLastFont
Definition: fntcache.cxx:66
SwViewShell const * GetShell() const
Definition: drawfont.hxx:179
constexpr TypedWhichId< SvxCrossedOutItem > RES_CHRATR_CROSSEDOUT(5)
const SvxColorItem & GetColor(bool=true) const
Definition: charatr.hxx:89
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SvxFontHeightItem & GetSize(bool=true) const
Definition: charatr.hxx:77
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
~SwFont()
Definition: swfont.cxx:824
constexpr TypedWhichId< SvxEscapementItem > RES_CHRATR_ESCAPEMENT(6)
void SetWordLineMode(const bool bWordLineMode)
Definition: swfont.hxx:675
const SvxContourItem & GetContour(bool=true) const
Definition: charatr.hxx:67
sal_uInt16 GetAscent(SwViewShell const *pSh, const OutputDevice &rOut)
Definition: swfont.cxx:948
vcl::RenderContext * GetpOut() const
Definition: drawfont.hxx:189
const SvxCharRotateItem & GetCharRotate(bool=true) const
Definition: charatr.hxx:109
SwFont * GetFont() const
Definition: drawfont.hxx:254
TextFrameIndex GetCapitalCursorOfst(SwDrawTextInfo &rInf)
Definition: fntcap.cxx:403
void Lock()
Definition: swcache.cxx:474
bool GetValue() const
tools::Long GetCharacterSpacing() const
Definition: drawfont.hxx:316
const SvxUnderlineItem & GetUnderline(bool=true) const
Definition: charatr.hxx:71
sal_uInt16 m_nOrgAscent
Definition: swfont.hxx:60
const SvxOverlineItem & GetOverline(bool=true) const
Definition: charatr.hxx:73
const SvxPostureItem & GetCTLPosture(bool=true) const
Definition: charatr.hxx:53
const Color & GetTextLineColor() const
sal_uInt16 GetFontHeight(const SwViewShell *pSh, const OutputDevice &rOut)
Definition: fntcache.cxx:311
const Color & GetUnderColor() const
Definition: swfont.hxx:273
std::optional< editeng::SvxBorderLine > m_aTopBorder
Definition: swfont.hxx:144
const SvxShadowedItem & GetShadowed(bool=true) const
Definition: charatr.hxx:61
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout...
Definition: txtfrm.cxx:476
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
long Long
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
bool ChgFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.cxx:876
TextFrameIndex GetModelPositionForViewPoint(SwDrawTextInfo &rInf)
Definition: fntcache.cxx:1965
void SetIdx(TextFrameIndex const nNew)
Definition: drawfont.hxx:479
const SvxLanguageItem & GetLanguage(bool=true) const
Definition: charatr.hxx:91
const SvxCrossedOutItem & GetCrossedOut(bool=true) const
Definition: charatr.hxx:75
void SetUnderline(const FontLineStyle eUnderline)
Definition: swfont.hxx:543
const SvxCharHiddenItem & GetCharHidden(bool=true) const
Definition: charatr.hxx:113
const std::optional< editeng::SvxBorderLine > & GetAbsRightBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
Definition: swfont.cxx:181
const SvxFont & GetActualFont() const
Definition: swfont.hxx:186
void SetGreyWave(bool bNew)
Definition: drawfont.hxx:587
void SetEmphasisMark(const FontEmphasisMark eValue)
Definition: swfont.hxx:689
const SvxLanguageItem & GetCJKLanguage(bool=true) const
Definition: charatr.hxx:93
sal_uInt16 GetFontAscent(const SwViewShell *pSh, const OutputDevice &rOut)
Definition: fntcache.cxx:273
void SetPos(const Point &rNew)
Definition: drawfont.hxx:401
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
void CalcEsc(SwDrawTextInfo const &rInf, Point &rPos)
Definition: swfont.cxx:1317
constexpr TypedWhichId< SvxAutoKernItem > RES_CHRATR_AUTOKERN(17)
sal_uInt16 GetWidth() const
Definition: drawfont.hxx:298
void SetWidth(sal_uInt16 nNew)
Definition: drawfont.hxx:507
sal_uInt8 m_nContentControlCount
Definition: swfont.hxx:162
#define DFLT_ESC_AUTO_SUB
bool m_bPaintBlank
Definition: swfont.hxx:168
constexpr TypedWhichId< SvxBoxItem > RES_CHRATR_BOX(40)
void SetOutline(const bool bOutline)
Definition: swfont.hxx:607
void SetPropWidth(const sal_uInt16 nNew)
Definition: swfont.hxx:697
Color m_aShadowColor
Definition: swfont.hxx:155
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:1438
FontPitch GetPitch() const
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
Degree10 GetOrientation(const bool bVertLayout=false, const bool bVertFormatLRBT=false) const
Definition: swfont.cxx:412
bool m_bFontChg
Definition: swfont.hxx:169
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
void SetBottomBorderDist(const sal_uInt16 nBottomDist)
Definition: swfont.hxx:841
sal_uInt16 m_nLeftBorderDist
Definition: swfont.hxx:153
constexpr TypedWhichId< SvxTwoLinesItem > RES_CHRATR_TWO_LINES(34)
bool IsCaseMap() const
FontFamily GetFamily() const
FontItalic GetPosture() const
void DrawCapital(SwDrawTextInfo &rInf)
Definition: fntcap.cxx:322
bool IsVertLRBT() const
Definition: frame.hxx:983
void SetColor(const Color &rColor)
Definition: swfont.hxx:418
const SwScriptInfo * GetScriptInfo() const
Definition: drawfont.hxx:194
constexpr tools::Long Width() const
constexpr TypedWhichId< SvxCaseMapItem > RES_CHRATR_CASEMAP(RES_CHRATR_BEGIN)
const Color & GetOverlineColor() const
void SetShadow(const bool bShadow)
Definition: swfont.hxx:622
sal_uInt16 m_nShadowWidth
Definition: swfont.hxx:156
sal_uInt16 m_nRightBorderDist
Definition: swfont.hxx:152
const Color & GetColor() const
Degree10 GetValue() const
void DrawStretchText(const Point &rStartPt, sal_uLong nWidth, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1)
const SwTextFrame * GetFrame() const
Definition: drawfont.hxx:169
const SvxFontHeightItem & GetCJKSize(bool=true) const
Definition: charatr.hxx:79
LINESTYLE_NONE
Color m_aOverColor
Definition: swfont.hxx:141
constexpr TypedWhichId< SvxShadowItem > RES_CHRATR_SHADOW(41)
const Color & GetOverColor() const
Definition: swfont.hxx:275
SwUnderlineFont(SwFont &rFnt, TextFrameIndex nEnd, const Point &rPoint)
Definition: swfont.cxx:1428
const vcl::Font & GetFont() const
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
void SetUnderFnt(SwUnderlineFont *pULFnt)
Definition: drawfont.hxx:566
rtl_TextEncoding GetCharSet() const
const SvxCaseMapItem & GetCaseMap(bool=true) const
Definition: charatr.hxx:99
const SvxFontHeightItem & GetCTLSize(bool=true) const
Definition: charatr.hxx:81
void SetKern(tools::Long nNew)
Definition: drawfont.hxx:520
void DrawStretchText_(SwDrawTextInfo &rInf)
Definition: swfont.cxx:1206
o3tl::enumarray< SwFontScript, SwSubFont > m_aSub
Definition: swfont.hxx:135
#define DFLT_ESC_AUTO_SUPER
SwFont(const SwAttrSet *pSet, const IDocumentSettingAccess *pIDocumentSettingAccess)
Definition: swfont.cxx:673
FontEmphasisMark GetEmphasisMark() const
bool IsSymbol() const
Definition: fntcache.hxx:110
sal_uInt16 m_nFontIndex
Definition: swfont.hxx:58
void SetShadowColor(const Color &rColor)
Definition: swfont.hxx:927
const SvxAutoKernItem & GetAutoKern(bool=true) const
Definition: charatr.hxx:63
Degree10 UnMapDirection(Degree10 nDir, const bool bVertFormat, const bool bVertFormatLRBT)
Definition: swfont.cxx:373
void SetUnderline(const FontLineStyle eUnderline)
Definition: swfont.hxx:549
constexpr TypedWhichId< SvxCharReliefItem > RES_CHRATR_RELIEF(36)
void SetShadowLocation(const SvxShadowLocation aLocation)
Definition: swfont.hxx:941
const std::optional< editeng::SvxBorderLine > & GetAbsBottomBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
Definition: swfont.cxx:143
SwUnderlineFont * GetUnderFnt() const
Definition: drawfont.hxx:262
void ChgPhysFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.cxx:893
sal_uInt16 GetHeight(SwViewShell const *pSh, const OutputDevice &rOut)
Definition: swfont.cxx:955
void SetStrikeout(const FontStrikeout eStrikeout)
Definition: swfont.hxx:579
SwFontScript GetActual() const
Definition: swfont.hxx:184
void SetLen(TextFrameIndex const nNew)
Definition: drawfont.hxx:485
void SetTextLineColor()
void SetLeftBorder(const editeng::SvxBorderLine *pLeftBorder)
Definition: swfont.cxx:110
const OUString & GetText() const
Definition: drawfont.hxx:220
const OUString & GetStyleName() const
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
std::optional< editeng::SvxBorderLine > m_aLeftBorder
Definition: swfont.hxx:147
Color m_aHighlightColor
Definition: swfont.hxx:139
const SvxWeightItem & GetCTLWeight(bool=true) const
Definition: charatr.hxx:59
const SvxCharScaleWidthItem & GetCharScaleW(bool=true) const
Definition: charatr.hxx:107
UNDERLYING_TYPE get() const
bool ApplyAutoColor(vcl::Font *pFnt=nullptr)
Definition: fntcache.cxx:2447
ALIGN_BASELINE
void SetTransparent(const bool bTrans)
Definition: swfont.hxx:647
SvxShadowItemSide
void SetLanguage(LanguageType eNewLang, const SwFontScript nWhich)
Definition: swfont.hxx:811
SwFontScript m_nActual
Definition: swfont.hxx:165
void SetRightBorder(const editeng::SvxBorderLine *pRightBorder)
Definition: swfont.cxx:97
std::optional< editeng::SvxBorderLine > m_aBottomBorder
Definition: swfont.hxx:145
sal_uInt8 m_nInputFieldCount
Definition: swfont.hxx:163
FontWeight GetWeight() const
void SetUnderColor(const Color &rColor)
Definition: swfont.hxx:216
void SetRightBorderDist(const sal_uInt16 nRightDist)
Definition: swfont.hxx:848
void SetShadowWidth(const sal_uInt16 nWidth)
Definition: swfont.hxx:934
const Point & GetPos() const
Definition: swfont.hxx:974
void DrawStretchCapital(SwDrawTextInfo &rInf)
Definition: fntcap.cxx:477
const SvxTwoLinesItem & Get2Lines(bool=true) const
Definition: charatr.hxx:105
void SetCaseMap(const SvxCaseMap eNew)
Definition: swfont.hxx:661
const std::optional< editeng::SvxBorderLine > & GetAbsTopBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
Definition: swfont.cxx:124
void DrawText_(SwDrawTextInfo &rInf, const bool bGrey)
Definition: swfont.cxx:1077
Size GetCapitalSize(SwDrawTextInfo &rInf)
Definition: fntcap.cxx:139
sal_uInt16 GetFontHangingBaseline(const SwViewShell *pSh, const OutputDevice &rOut)
Definition: fntcache.cxx:401
void SetVertical(Degree10 nDir, const bool bVertLayout=false, const bool bVertLayoutLRBT=false)
Definition: swfont.cxx:417
const sal_Unicode CH_BLANK
Definition: swfont.hxx:42
bool m_bOrgChg
Definition: swfont.hxx:170
sal_uInt16 GetHangingBaseline(SwViewShell const *pSh, const OutputDevice &rOut)
Definition: swfont.cxx:968
constexpr TypedWhichId< SvxShadowedItem > RES_CHRATR_SHADOWED(13)
SwFont & GetFont()
Definition: swfont.hxx:969
void SetRelief(const FontRelief eNew)
Definition: swfont.hxx:715
#define CH_TXT_ATR_FIELDSTART
Definition: hintids.hxx:182
sal_uInt8 m_nToxCount
Definition: swfont.hxx:159
const SvxFontItem & GetCJKFont(bool=true) const
Definition: charatr.hxx:85
void SetEscapement(const short nNewEsc)
Definition: swfont.hxx:788
Provides access to settings of a document.
void DrawStretchText_(SwDrawTextInfo &rInf)
Definition: swfont.hxx:321
const SvxLanguageItem & GetCTLLanguage(bool=true) const
Definition: charatr.hxx:95
SvxCaseMap GetCaseMap() const
void SetOverlineColor()
constexpr TypedWhichId< SvxOverlineItem > RES_CHRATR_OVERLINE(38)
constexpr TypedWhichId< SvxEmphasisMarkItem > RES_CHRATR_EMPHASIS_MARK(33)
const SvxEscapementItem & GetEscapement(bool=true) const
Definition: charatr.hxx:97
constexpr OUStringLiteral CH_TXT_ATR_SUBST_FIELDSTART
Definition: hintids.hxx:185
TextFrameIndex GetModelPositionForViewPoint_(SwDrawTextInfo &rInf)
Definition: swfont.cxx:1284
void SetOverColor(const Color &rColor)
Definition: swfont.hxx:218
#define SV_STAT(nWhich)
Definition: swfont.hxx:998
std::optional< Color > mxBackColor
Definition: swfont.hxx:138
sal_uInt16 m_nBottomBorderDist
Definition: swfont.hxx:151
const SvxEmphasisMarkItem & GetEmphasisMark(bool=true) const
Definition: charatr.hxx:103
void SetFixKerning(const short nNewKern)
Definition: swfont.hxx:654
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 SetBottomBorder(const editeng::SvxBorderLine *pBottomBorder)
Definition: swfont.cxx:84
FontLineStyle GetLineStyle() const
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
Definition: txtfrm.cxx:686
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
Size GetTextSize_(SwDrawTextInfo &rInf)
Definition: swfont.cxx:974
SwFont & operator=(const SwFont &rFont)
Definition: swfont.cxx:828
const OUString & GetFamilyName() const
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
LanguageType GetLanguage() const
void Shift(Degree10 nDir)
Definition: swfont.cxx:1388
bool IsSymbol(SwViewShell const *pSh)
Definition: swfont.cxx:870
void SetDevFont(const SwViewShell *pSh, OutputDevice &rOut)
Definition: fntcache.cxx:572
LanguageType GetLanguage() const
Definition: swfont.hxx:283
SwFntObj * Get()
Definition: fntcache.hxx:141
tools::Long GetSpace() const
Definition: drawfont.hxx:329
sal_uInt32 GetHeight() const
const SvxWeightItem & GetCJKWeight(bool=true) const
Definition: charatr.hxx:57
const void * m_nFontCacheId
Definition: swfont.hxx:56
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
bool IsCapital() const
void SetBackColor(std::optional< Color > xNewColor)
Definition: swfont.cxx:64
void SetAlign(const TextAlign eAlign)
Definition: swfont.hxx:521
unsigned char sal_uInt8
constexpr TypedWhichId< SvxWordLineModeItem > RES_CHRATR_WORDLINEMODE(16)
sal_uInt16 CalcEscAscent(const sal_uInt16 nOldAscent) const
Definition: swfont.cxx:460
LINESTYLE_DOTTED
const SvxKerningItem & GetKerning(bool=true) const
Definition: charatr.hxx:69
void SetFont(const vcl::Font &rNewFont)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CTL_WEIGHT(31)
const Point & GetPos() const
Definition: drawfont.hxx:199
void SetTextIdxLen(const OUString &rNewStr, TextFrameIndex const nNewIdx, TextFrameIndex const nNewLen)
Definition: drawfont.hxx:425
void SetTopBorder(const editeng::SvxBorderLine *pTopBorder)
Definition: swfont.cxx:71
tools::Long GetTextHeight() const
TextFrameIndex GetLen() const
Definition: drawfont.hxx:272
sal_uInt8 m_nRefCount
Definition: swfont.hxx:160
const Size & GetSize() const
Definition: drawfont.hxx:246
void SetActual(SwFontScript nNew)
Definition: swfont.hxx:751
short CheckKerning_()
Definition: swfont.cxx:939
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
std::optional< editeng::SvxBorderLine > m_aRightBorder
Definition: swfont.hxx:146
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CTL_POSTURE(30)
OUString CalcCaseMap(const OUString &rTxt) const
bool IsRightToLeft() const
Definition: frame.hxx:987
short GetEscapement() const
const SvxPostureItem & GetPosture(bool=true) const
Definition: charatr.hxx:49
SwFontScript
Definition: swfont.hxx:123
void Invalidate()
Definition: swfont.hxx:335
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
FontStrikeout GetStrikeout() const
vcl::RenderContext & GetOut() const
Definition: drawfont.hxx:184
const SvxWordLineModeItem & GetWordLineMode(bool=true) const
Definition: charatr.hxx:65
#define CH_TXT_ATR_FIELDEND
Definition: hintids.hxx:184
tools::Long GetKern() const
Definition: drawfont.hxx:324
void Unlock()
Definition: swcache.cxx:480
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
SvStatistics g_SvStat
Definition: swfont.cxx:58
void setHeight(tools::Long nHeight)
void DrawText(SwDrawTextInfo &rInf)
Definition: fntcache.cxx:790
bool IsVertical() const
Definition: frame.hxx:973
#define SPACING_PRECISION_FACTOR
Definition: scriptinfo.hxx:40
#define SAL_WARN(area, stream)
void SetText(const OUString &rNew)
Definition: drawfont.hxx:417
short GetFixKerning() const
void SetAutoKern(FontKerning nAutoKern)
Definition: swfont.hxx:637
TextFrameIndex GetIdx() const
Definition: drawfont.hxx:267
void SetDiffFnt(const SfxItemSet *pSet, const IDocumentSettingAccess *pIDocumentSettingAccess)
Definition: swfont.cxx:473
SvxShadowLocation m_aShadowLocation
Definition: swfont.hxx:157
constexpr TypedWhichId< SvxCharRotateItem > RES_CHRATR_ROTATE(32)
bool IsSpaceStop() const
Definition: drawfont.hxx:376
sal_uInt16 CalcEscHeight(const sal_uInt16 nOldHeight, const sal_uInt16 nOldAscent) const
Definition: swfont.cxx:923
sal_uInt16 m_nTopBorderDist
Definition: swfont.hxx:150
const std::optional< editeng::SvxBorderLine > & GetAbsLeftBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
Definition: swfont.cxx:162
STRIKEOUT_NONE
void SetProportion(const sal_uInt8 nNewPropr)
Definition: swfont.hxx:769
SvxShadowLocation GetAbsShadowLocation(const bool bVertLayout, const bool bVertLayoutLRBT) const
Get the absolute shadow location dependent from orientation.
Definition: swfont.cxx:199
void SetHighlightColor(const Color &aNewColor)
Definition: swfont.hxx:948
FontLineStyle
void ChgFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.hxx:177
Color m_aUnderColor
Definition: swfont.hxx:140
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
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...
constexpr OUStringLiteral CH_TXT_ATR_SUBST_FIELDEND
Definition: hintids.hxx:186
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_HIGHLIGHT(42)
sal_uInt16 m_nOrgHeight
Definition: swfont.hxx:59
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
const SvxWeightItem & GetWeight(bool=true) const
Definition: charatr.hxx:55
constexpr TypedWhichId< SvxKerningItem > RES_CHRATR_KERNING(9)
sal_uInt8 m_nMetaCount
Definition: swfont.hxx:161
void SetOverline(const FontLineStyle eOverline)
Definition: swfont.hxx:564
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
const SvxFontItem & GetFont(bool=true) const
Definition: charatr.hxx:83
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
void SetTopBorderDist(const sal_uInt16 nTopDist)
Definition: swfont.hxx:834
const SvxPostureItem & GetCJKPosture(bool=true) const
Definition: charatr.hxx:51
const SvxCharReliefItem & GetCharRelief(bool=true) const
Definition: charatr.hxx:111
const Color & GetValue() const
static Degree10 MapDirection(Degree10 nDir, const bool bVertFormat, const bool bVertFormatLRBT)
Definition: swfont.cxx:343
void AllocFontCacheId(SwViewShell const *pSh, SwFontScript nWhich)
Definition: swfont.cxx:864
const void * GetOwner() const
Definition: swcache.hxx:168
Size GetTextSize(SwDrawTextInfo &rInf)
determine the TextSize (of the printer)
Definition: fntcache.cxx:1806
SvxShadowLocation
short CheckKerning()
Definition: swfont.hxx:113
constexpr TypedWhichId< SvxContourItem > RES_CHRATR_CONTOUR(4)
bool m_bGreyWave
Definition: swfont.hxx:171