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