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