LibreOffice Module vcl (master)  1
font/font.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 <tools/stream.hxx>
21 #include <tools/vcompat.hxx>
22 #include <tools/gen.hxx>
23 #include <unotools/fontcfg.hxx>
24 #include <unotools/fontdefs.hxx>
25 
26 #include <vcl/font.hxx>
27 
28 #include <impfont.hxx>
29 #include <fontattributes.hxx>
30 #include <sft.hxx>
31 
32 #include <algorithm>
33 
34 #include <rtl/instance.hxx>
35 
36 using namespace vcl;
37 
38 namespace
39 {
40  struct theGlobalDefault :
41  public rtl::Static< Font::ImplType, theGlobalDefault > {};
42 }
43 
44 Font::Font() : mpImplFont(theGlobalDefault::get())
45 {
46 }
47 
48 Font::Font( const vcl::Font& rFont ) : mpImplFont( rFont.mpImplFont )
49 {
50 }
51 
52 Font::Font( vcl::Font&& rFont ) noexcept : mpImplFont( std::move(rFont.mpImplFont) )
53 {
54 }
55 
56 Font::Font( const OUString& rFamilyName, const Size& rSize ) : mpImplFont()
57 {
58  mpImplFont->SetFamilyName( rFamilyName );
59  mpImplFont->SetFontSize( rSize );
60 }
61 
62 Font::Font( const OUString& rFamilyName, const OUString& rStyleName, const Size& rSize ) : mpImplFont()
63 {
64  mpImplFont->SetFamilyName( rFamilyName );
65  mpImplFont->SetStyleName( rStyleName );
66  mpImplFont->SetFontSize( rSize );
67 }
68 
69 Font::Font( FontFamily eFamily, const Size& rSize ) : mpImplFont()
70 {
71  mpImplFont->SetFamilyType( eFamily );
72  mpImplFont->SetFontSize( rSize );
73 }
74 
76 {
77 }
78 
79 void Font::SetColor( const Color& rColor )
80 {
81  if (const_cast<const ImplType&>(mpImplFont)->maColor != rColor)
82  {
83  mpImplFont->maColor = rColor;
84  }
85 }
86 
87 void Font::SetFillColor( const Color& rColor )
88 {
89  mpImplFont->maFillColor = rColor;
90  if ( rColor.GetTransparency() )
91  mpImplFont->mbTransparent = true;
92 }
93 
94 void Font::SetTransparent( bool bTransparent )
95 {
96  if (const_cast<const ImplType&>(mpImplFont)->mbTransparent != bTransparent)
97  mpImplFont->mbTransparent = bTransparent;
98 }
99 
101 {
102  if (const_cast<const ImplType&>(mpImplFont)->meAlign != eAlign)
103  mpImplFont->SetAlignment(eAlign);
104 }
105 
106 void Font::SetFamilyName( const OUString& rFamilyName )
107 {
108  mpImplFont->SetFamilyName( rFamilyName );
109 }
110 
111 void Font::SetStyleName( const OUString& rStyleName )
112 {
113  mpImplFont->maStyleName = rStyleName;
114 }
115 
116 void Font::SetFontSize( const Size& rSize )
117 {
118  if (const_cast<const ImplType&>(mpImplFont)->GetFontSize() != rSize)
119  mpImplFont->SetFontSize( rSize );
120 }
121 
123 {
124  if (const_cast<const ImplType&>(mpImplFont)->GetFamilyTypeNoAsk() != eFamily)
125  mpImplFont->SetFamilyType( eFamily );
126 }
127 
128 void Font::SetCharSet( rtl_TextEncoding eCharSet )
129 {
130  if (const_cast<const ImplType&>(mpImplFont)->GetCharSet() != eCharSet)
131  {
132  mpImplFont->SetCharSet( eCharSet );
133 
134  if ( eCharSet == RTL_TEXTENCODING_SYMBOL )
135  mpImplFont->SetSymbolFlag( true );
136  else
137  mpImplFont->SetSymbolFlag( false );
138  }
139 }
140 
141 bool Font::IsSymbolFont() const
142 {
143  return mpImplFont->IsSymbolFont();
144 }
145 
146 void Font::SetSymbolFlag( bool bSymbol )
147 {
148  mpImplFont->SetSymbolFlag( bSymbol );
149 
150  if ( IsSymbolFont() )
151  {
152  mpImplFont->SetCharSet( RTL_TEXTENCODING_SYMBOL );
153  }
154  else
155  {
156  if ( mpImplFont->GetCharSet() == RTL_TEXTENCODING_SYMBOL )
157  mpImplFont->SetCharSet( RTL_TEXTENCODING_DONTKNOW );
158  }
159 }
160 
161 void Font::SetLanguageTag( const LanguageTag& rLanguageTag )
162 {
163  if (const_cast<const ImplType&>(mpImplFont)->maLanguageTag != rLanguageTag)
164  mpImplFont->maLanguageTag = rLanguageTag;
165 }
166 
167 void Font::SetCJKContextLanguageTag( const LanguageTag& rLanguageTag )
168 {
169  if (const_cast<const ImplType&>(mpImplFont)->maCJKLanguageTag != rLanguageTag)
170  mpImplFont->maCJKLanguageTag = rLanguageTag;
171 }
172 
174 {
175  if (const_cast<const ImplType&>(mpImplFont)->maLanguageTag.getLanguageType(false) != eLanguage)
176  mpImplFont->maLanguageTag.reset( eLanguage);
177 }
178 
180 {
181  if (const_cast<const ImplType&>(mpImplFont)->maCJKLanguageTag.getLanguageType(false) != eLanguage)
182  mpImplFont->maCJKLanguageTag.reset( eLanguage);
183 }
184 
185 void Font::SetPitch( FontPitch ePitch )
186 {
187  if (const_cast<const ImplType&>(mpImplFont)->GetPitchNoAsk() != ePitch)
188  mpImplFont->SetPitch( ePitch );
189 }
190 
191 void Font::SetOrientation( short nOrientation )
192 {
193  if (const_cast<const ImplType&>(mpImplFont)->mnOrientation != nOrientation)
194  mpImplFont->mnOrientation = nOrientation;
195 }
196 
197 void Font::SetVertical( bool bVertical )
198 {
199  if (const_cast<const ImplType&>(mpImplFont)->mbVertical != bVertical)
200  mpImplFont->mbVertical = bVertical;
201 }
202 
204 {
205  if (const_cast<const ImplType&>(mpImplFont)->meKerning != eKerning)
206  mpImplFont->meKerning = eKerning;
207 }
208 
209 bool Font::IsKerning() const
210 {
212 }
213 
215 {
216  if (const_cast<const ImplType&>(mpImplFont)->GetWeightNoAsk() != eWeight)
217  mpImplFont->SetWeight( eWeight );
218 }
219 
221 {
222  if (const_cast<const ImplType&>(mpImplFont)->GetWidthTypeNoAsk() != eWidth)
223  mpImplFont->SetWidthType( eWidth );
224 }
225 
227 {
228  if (const_cast<const ImplType&>(mpImplFont)->GetItalicNoAsk() != eItalic)
229  mpImplFont->SetItalic( eItalic );
230 }
231 
232 void Font::SetOutline( bool bOutline )
233 {
234  if (const_cast<const ImplType&>(mpImplFont)->mbOutline != bOutline)
235  mpImplFont->mbOutline = bOutline;
236 }
237 
238 void Font::SetShadow( bool bShadow )
239 {
240  if (const_cast<const ImplType&>(mpImplFont)->mbShadow != bShadow)
241  mpImplFont->mbShadow = bShadow;
242 }
243 
245 {
246  if (const_cast<const ImplType&>(mpImplFont)->meUnderline != eUnderline)
247  mpImplFont->meUnderline = eUnderline;
248 }
249 
251 {
252  if (const_cast<const ImplType&>(mpImplFont)->meOverline != eOverline)
253  mpImplFont->meOverline = eOverline;
254 }
255 
257 {
258  if (const_cast<const ImplType&>(mpImplFont)->meStrikeout != eStrikeout)
259  mpImplFont->meStrikeout = eStrikeout;
260 }
261 
263 {
264  if (const_cast<const ImplType&>(mpImplFont)->meRelief != eRelief)
265  mpImplFont->meRelief = eRelief;
266 }
267 
269 {
270  if (const_cast<const ImplType&>(mpImplFont)->meEmphasisMark != eEmphasisMark )
271  mpImplFont->meEmphasisMark = eEmphasisMark;
272 }
273 
274 void Font::SetWordLineMode( bool bWordLine )
275 {
276  if (const_cast<const ImplType&>(mpImplFont)->mbWordLine != bWordLine)
277  mpImplFont->mbWordLine = bWordLine;
278 }
279 
281 {
282  mpImplFont = rFont.mpImplFont;
283  return *this;
284 }
285 
286 Font& Font::operator=( vcl::Font&& rFont ) noexcept
287 {
288  mpImplFont = std::move(rFont.mpImplFont);
289  return *this;
290 }
291 
292 bool Font::operator==( const vcl::Font& rFont ) const
293 {
294  return mpImplFont == rFont.mpImplFont;
295 }
296 
297 void Font::Merge( const vcl::Font& rFont )
298 {
299  if ( !rFont.GetFamilyName().isEmpty() )
300  {
301  SetFamilyName( rFont.GetFamilyName() );
302  SetStyleName( rFont.GetStyleName() );
303  SetCharSet( GetCharSet() );
304  SetLanguageTag( rFont.GetLanguageTag() );
306  // don't use access methods here, might lead to AskConfig(), if DONTKNOW
308  SetPitch( rFont.mpImplFont->GetPitchNoAsk() );
309  }
310 
311  // don't use access methods here, might lead to AskConfig(), if DONTKNOW
312  if ( rFont.mpImplFont->GetWeightNoAsk() != WEIGHT_DONTKNOW )
313  SetWeight( rFont.GetWeight() );
314  if ( rFont.mpImplFont->GetItalicNoAsk() != ITALIC_DONTKNOW )
315  SetItalic( rFont.GetItalic() );
316  if ( rFont.mpImplFont->GetWidthTypeNoAsk() != WIDTH_DONTKNOW )
317  SetWidthType( rFont.GetWidthType() );
318 
319  if ( rFont.GetFontSize().Height() )
320  SetFontSize( rFont.GetFontSize() );
321  if ( rFont.GetUnderline() != LINESTYLE_DONTKNOW )
322  {
323  SetUnderline( rFont.GetUnderline() );
324  SetWordLineMode( rFont.IsWordLineMode() );
325  }
326  if ( rFont.GetOverline() != LINESTYLE_DONTKNOW )
327  {
328  SetOverline( rFont.GetOverline() );
329  SetWordLineMode( rFont.IsWordLineMode() );
330  }
331  if ( rFont.GetStrikeout() != STRIKEOUT_DONTKNOW )
332  {
333  SetStrikeout( rFont.GetStrikeout() );
334  SetWordLineMode( rFont.IsWordLineMode() );
335  }
336 
337  // Defaults?
338  SetOrientation( rFont.GetOrientation() );
339  SetVertical( rFont.IsVertical() );
340  SetEmphasisMark( rFont.GetEmphasisMark() );
342  SetOutline( rFont.IsOutline() );
343  SetShadow( rFont.IsShadow() );
344  SetRelief( rFont.GetRelief() );
345 }
346 
348 {
352  rAttrs.SetPitch( mpImplFont->GetPitchNoAsk() );
353  rAttrs.SetItalic( mpImplFont->GetItalicNoAsk() );
354  rAttrs.SetWeight( mpImplFont->GetWeightNoAsk() );
355  rAttrs.SetWidthType( WIDTH_DONTKNOW );
356  rAttrs.SetSymbolFlag( mpImplFont->GetCharSet() == RTL_TEXTENCODING_SYMBOL );
357 }
358 
359 SvStream& ReadImplFont( SvStream& rIStm, ImplFont& rImplFont )
360 {
361  VersionCompat aCompat( rIStm, StreamMode::READ );
362  sal_uInt16 nTmp16(0);
363  bool bTmp(false);
364  sal_uInt8 nTmp8(0);
365 
366  rImplFont.SetFamilyName( rIStm.ReadUniOrByteString(rIStm.GetStreamCharSet()) );
367  rImplFont.maStyleName = rIStm.ReadUniOrByteString(rIStm.GetStreamCharSet());
368  ReadPair( rIStm, rImplFont.maAverageFontSize );
369 
370  rIStm.ReadUInt16( nTmp16 ); rImplFont.SetCharSet( static_cast<rtl_TextEncoding>(nTmp16) );
371  rIStm.ReadUInt16( nTmp16 ); rImplFont.SetFamilyType( static_cast<FontFamily>(nTmp16) );
372  rIStm.ReadUInt16( nTmp16 ); rImplFont.SetPitch( static_cast<FontPitch>(nTmp16) );
373  rIStm.ReadUInt16( nTmp16 ); rImplFont.SetWeight( static_cast<FontWeight>(nTmp16) );
374  rIStm.ReadUInt16( nTmp16 ); rImplFont.meUnderline = static_cast<FontLineStyle>(nTmp16);
375  rIStm.ReadUInt16( nTmp16 ); rImplFont.meStrikeout = static_cast<FontStrikeout>(nTmp16);
376  rIStm.ReadUInt16( nTmp16 ); rImplFont.SetItalic( static_cast<FontItalic>(nTmp16) );
377  rIStm.ReadUInt16( nTmp16 ); rImplFont.maLanguageTag.reset( LanguageType(nTmp16) );
378  rIStm.ReadUInt16( nTmp16 ); rImplFont.meWidthType = static_cast<FontWidth>(nTmp16);
379 
380  rIStm.ReadInt16( rImplFont.mnOrientation );
381 
382  rIStm.ReadCharAsBool( bTmp ); rImplFont.mbWordLine = bTmp;
383  rIStm.ReadCharAsBool( bTmp ); rImplFont.mbOutline = bTmp;
384  rIStm.ReadCharAsBool( bTmp ); rImplFont.mbShadow = bTmp;
385  rIStm.ReadUChar( nTmp8 ); rImplFont.meKerning = static_cast<FontKerning>(nTmp8);
386 
387  if( aCompat.GetVersion() >= 2 )
388  {
389  rIStm.ReadUChar( nTmp8 ); rImplFont.meRelief = static_cast<FontRelief>(nTmp8);
390  rIStm.ReadUInt16( nTmp16 ); rImplFont.maCJKLanguageTag.reset( LanguageType(nTmp16) );
391  rIStm.ReadCharAsBool( bTmp ); rImplFont.mbVertical = bTmp;
392  rIStm.ReadUInt16( nTmp16 ); rImplFont.meEmphasisMark = static_cast<FontEmphasisMark>(nTmp16);
393  }
394 
395  if( aCompat.GetVersion() >= 3 )
396  {
397  rIStm.ReadUInt16( nTmp16 ); rImplFont.meOverline = static_cast<FontLineStyle>(nTmp16);
398  }
399 
400  // Relief
401  // CJKContextLanguage
402 
403  return rIStm;
404 }
405 
406 SvStream& WriteImplFont( SvStream& rOStm, const ImplFont& rImplFont )
407 {
408  VersionCompat aCompat( rOStm, StreamMode::WRITE, 3 );
409  rOStm.WriteUniOrByteString( rImplFont.GetFamilyName(), rOStm.GetStreamCharSet() );
410  rOStm.WriteUniOrByteString( rImplFont.GetStyleName(), rOStm.GetStreamCharSet() );
411  WritePair( rOStm, rImplFont.maAverageFontSize );
412 
413  rOStm.WriteUInt16( GetStoreCharSet( rImplFont.GetCharSet() ) );
414  rOStm.WriteUInt16( rImplFont.GetFamilyTypeNoAsk() );
415  rOStm.WriteUInt16( rImplFont.GetPitchNoAsk() );
416  rOStm.WriteUInt16( rImplFont.GetWeightNoAsk() );
417  rOStm.WriteUInt16( rImplFont.meUnderline );
418  rOStm.WriteUInt16( rImplFont.meStrikeout );
419  rOStm.WriteUInt16( rImplFont.GetItalicNoAsk() );
420  rOStm.WriteUInt16( static_cast<sal_uInt16>(rImplFont.maLanguageTag.getLanguageType( false)) );
421  rOStm.WriteUInt16( rImplFont.GetWidthTypeNoAsk() );
422 
423  rOStm.WriteInt16( rImplFont.mnOrientation );
424 
425  rOStm.WriteBool( rImplFont.mbWordLine );
426  rOStm.WriteBool( rImplFont.mbOutline );
427  rOStm.WriteBool( rImplFont.mbShadow );
428  rOStm.WriteUChar( static_cast<sal_uInt8>(rImplFont.meKerning) );
429 
430  // new in version 2
431  rOStm.WriteUChar( static_cast<sal_uChar>(rImplFont.meRelief) );
432  rOStm.WriteUInt16( static_cast<sal_uInt16>(rImplFont.maCJKLanguageTag.getLanguageType( false)) );
433  rOStm.WriteBool( rImplFont.mbVertical );
434  rOStm.WriteUInt16( static_cast<sal_uInt16>(rImplFont.meEmphasisMark) );
435 
436  // new in version 3
437  rOStm.WriteUInt16( rImplFont.meOverline );
438 
439  return rOStm;
440 }
441 
443 {
444  return ReadImplFont( rIStm, *rFont.mpImplFont );
445 }
446 
447 SvStream& WriteFont( SvStream& rOStm, const vcl::Font& rFont )
448 {
449  return WriteImplFont( rOStm, *rFont.mpImplFont );
450 }
451 
452 namespace
453 {
454  bool identifyTrueTypeFont( const void* i_pBuffer, sal_uInt32 i_nSize, Font& o_rResult )
455  {
456  bool bResult = false;
457  TrueTypeFont* pTTF = nullptr;
458  if( OpenTTFontBuffer( i_pBuffer, i_nSize, 0, &pTTF ) == SFErrCodes::Ok )
459  {
460  TTGlobalFontInfo aInfo;
461  GetTTGlobalFontInfo( pTTF, &aInfo );
462  // most importantly: the family name
463  if( aInfo.ufamily )
464  o_rResult.SetFamilyName( aInfo.ufamily );
465  else if( aInfo.family )
466  o_rResult.SetFamilyName( OStringToOUString( aInfo.family, RTL_TEXTENCODING_ASCII_US ) );
467  // set weight
468  if( aInfo.weight )
469  {
470  if( aInfo.weight < FW_EXTRALIGHT )
471  o_rResult.SetWeight( WEIGHT_THIN );
472  else if( aInfo.weight < FW_LIGHT )
473  o_rResult.SetWeight( WEIGHT_ULTRALIGHT );
474  else if( aInfo.weight < FW_NORMAL )
475  o_rResult.SetWeight( WEIGHT_LIGHT );
476  else if( aInfo.weight < FW_MEDIUM )
477  o_rResult.SetWeight( WEIGHT_NORMAL );
478  else if( aInfo.weight < FW_SEMIBOLD )
479  o_rResult.SetWeight( WEIGHT_MEDIUM );
480  else if( aInfo.weight < FW_BOLD )
481  o_rResult.SetWeight( WEIGHT_SEMIBOLD );
482  else if( aInfo.weight < FW_EXTRABOLD )
483  o_rResult.SetWeight( WEIGHT_BOLD );
484  else if( aInfo.weight < FW_BLACK )
485  o_rResult.SetWeight( WEIGHT_ULTRABOLD );
486  else
487  o_rResult.SetWeight( WEIGHT_BLACK );
488  }
489  else
490  o_rResult.SetWeight( (aInfo.macStyle & 1) ? WEIGHT_BOLD : WEIGHT_NORMAL );
491  // set width
492  if( aInfo.width )
493  {
494  if( aInfo.width == FWIDTH_ULTRA_CONDENSED )
495  o_rResult.SetAverageFontWidth( WIDTH_ULTRA_CONDENSED );
496  else if( aInfo.width == FWIDTH_EXTRA_CONDENSED )
497  o_rResult.SetAverageFontWidth( WIDTH_EXTRA_CONDENSED );
498  else if( aInfo.width == FWIDTH_CONDENSED )
499  o_rResult.SetAverageFontWidth( WIDTH_CONDENSED );
500  else if( aInfo.width == FWIDTH_SEMI_CONDENSED )
501  o_rResult.SetAverageFontWidth( WIDTH_SEMI_CONDENSED );
502  else if( aInfo.width == FWIDTH_NORMAL )
503  o_rResult.SetAverageFontWidth( WIDTH_NORMAL );
504  else if( aInfo.width == FWIDTH_SEMI_EXPANDED )
505  o_rResult.SetAverageFontWidth( WIDTH_SEMI_EXPANDED );
506  else if( aInfo.width == FWIDTH_EXPANDED )
507  o_rResult.SetAverageFontWidth( WIDTH_EXPANDED );
508  else if( aInfo.width == FWIDTH_EXTRA_EXPANDED )
509  o_rResult.SetAverageFontWidth( WIDTH_EXTRA_EXPANDED );
510  else if( aInfo.width >= FWIDTH_ULTRA_EXPANDED )
511  o_rResult.SetAverageFontWidth( WIDTH_ULTRA_EXPANDED );
512  }
513  // set italic
514  o_rResult.SetItalic( (aInfo.italicAngle != 0) ? ITALIC_NORMAL : ITALIC_NONE );
515 
516  // set pitch
517  o_rResult.SetPitch( (aInfo.pitch == 0) ? PITCH_VARIABLE : PITCH_FIXED );
518 
519  // set style name
520  if( aInfo.usubfamily )
521  o_rResult.SetStyleName( OUString( aInfo.usubfamily ) );
522  else if( aInfo.subfamily )
523  o_rResult.SetStyleName( OUString::createFromAscii( aInfo.subfamily ) );
524 
525  // cleanup
526  CloseTTFont( pTTF );
527  // success
528  bResult = true;
529  }
530  return bResult;
531  }
532 
533  static struct WeightSearchEntry
534  {
535  const char* string;
536  int string_len;
537  FontWeight weight;
538 
539  bool operator<( const WeightSearchEntry& rRight ) const
540  {
541  return rtl_str_compareIgnoreAsciiCase_WithLength( string, string_len, rRight.string, rRight.string_len ) < 0;
542  }
543  }
544  const weight_table[] =
545  {
546  { "black", 5, WEIGHT_BLACK },
547  { "bold", 4, WEIGHT_BOLD },
548  { "book", 4, WEIGHT_LIGHT },
549  { "demi", 4, WEIGHT_SEMIBOLD },
550  { "heavy", 5, WEIGHT_BLACK },
551  { "light", 5, WEIGHT_LIGHT },
552  { "medium", 6, WEIGHT_MEDIUM },
553  { "regular", 7, WEIGHT_NORMAL },
554  { "super", 5, WEIGHT_ULTRABOLD },
555  { "thin", 4, WEIGHT_THIN }
556  };
557 
558  bool identifyType1Font( const char* i_pBuffer, sal_uInt32 i_nSize, Font& o_rResult )
559  {
560  // might be a type1, find eexec
561  const char* pStream = i_pBuffer;
562  const char* const pExec = "eexec";
563  const char* pExecPos = std::search( pStream, pStream+i_nSize, pExec, pExec+5 );
564  if( pExecPos != pStream+i_nSize)
565  {
566  // find /FamilyName entry
567  static const char* const pFam = "/FamilyName";
568  const char* pFamPos = std::search( pStream, pExecPos, pFam, pFam+11 );
569  if( pFamPos != pExecPos )
570  {
571  // extract the string value behind /FamilyName
572  const char* pOpen = pFamPos+11;
573  while( pOpen < pExecPos && *pOpen != '(' )
574  pOpen++;
575  const char* pClose = pOpen;
576  while( pClose < pExecPos && *pClose != ')' )
577  pClose++;
578  if( pClose - pOpen > 1 )
579  {
580  o_rResult.SetFamilyName( OStringToOUString( OString( pOpen+1, pClose-pOpen-1 ), RTL_TEXTENCODING_ASCII_US ) );
581  }
582  }
583 
584  // parse /ItalicAngle
585  static const char* const pItalic = "/ItalicAngle";
586  const char* pItalicPos = std::search( pStream, pExecPos, pItalic, pItalic+12 );
587  if( pItalicPos != pExecPos )
588  {
589  sal_Int32 nItalic = rtl_str_toInt32( pItalicPos+12, 10 );
590  o_rResult.SetItalic( (nItalic != 0) ? ITALIC_NORMAL : ITALIC_NONE );
591  }
592 
593  // parse /Weight
594  static const char* const pWeight = "/Weight";
595  const char* pWeightPos = std::search( pStream, pExecPos, pWeight, pWeight+7 );
596  if( pWeightPos != pExecPos )
597  {
598  // extract the string value behind /Weight
599  const char* pOpen = pWeightPos+7;
600  while( pOpen < pExecPos && *pOpen != '(' )
601  pOpen++;
602  const char* pClose = pOpen;
603  while( pClose < pExecPos && *pClose != ')' )
604  pClose++;
605  if( pClose - pOpen > 1 )
606  {
607  WeightSearchEntry aEnt;
608  aEnt.string = pOpen+1;
609  aEnt.string_len = (pClose-pOpen)-1;
610  aEnt.weight = WEIGHT_NORMAL;
611  WeightSearchEntry const * pFound = std::lower_bound( std::begin(weight_table), std::end(weight_table), aEnt );
612  if( pFound != std::end(weight_table) &&
613  rtl_str_compareIgnoreAsciiCase_WithLength( pFound->string, pFound->string_len, aEnt.string, aEnt.string_len) == 0 )
614  o_rResult.SetWeight( pFound->weight );
615  }
616  }
617 
618  // parse isFixedPitch
619  static const char* const pFixed = "/isFixedPitch";
620  const char* pFixedPos = std::search( pStream, pExecPos, pFixed, pFixed+13 );
621  if( pFixedPos != pExecPos )
622  {
623  // skip whitespace
624  while( pFixedPos < pExecPos-4 &&
625  ( *pFixedPos == ' ' ||
626  *pFixedPos == '\t' ||
627  *pFixedPos == '\r' ||
628  *pFixedPos == '\n' ) )
629  {
630  pFixedPos++;
631  }
632  // find "true" value
633  if( rtl_str_compareIgnoreAsciiCase_WithLength( pFixedPos, 4, "true", 4 ) == 0 )
634  o_rResult.SetPitch( PITCH_FIXED );
635  else
636  o_rResult.SetPitch( PITCH_VARIABLE );
637  }
638  }
639  return false;
640  }
641 }
642 
643 Font Font::identifyFont( const void* i_pBuffer, sal_uInt32 i_nSize )
644 {
645  Font aResult;
646  if( ! identifyTrueTypeFont( i_pBuffer, i_nSize, aResult ) )
647  {
648  const char* pStream = static_cast<const char*>(i_pBuffer);
649  if( pStream && i_nSize > 100 &&
650  *pStream == '%' && pStream[1] == '!' )
651  {
652  identifyType1Font( pStream, i_nSize, aResult );
653  }
654  }
655 
656  return aResult;
657 }
658 
659 // The inlines from the font.hxx header are now instantiated for pImpl-ification
660 const Color& Font::GetColor() const { return mpImplFont->maColor; }
661 const Color& Font::GetFillColor() const { return mpImplFont->maFillColor; }
663 
665 
666 const OUString& Font::GetFamilyName() const { return mpImplFont->GetFamilyName(); }
667 const OUString& Font::GetStyleName() const { return mpImplFont->maStyleName; }
668 
669 const Size& Font::GetFontSize() const { return mpImplFont->GetFontSize(); }
670 void Font::SetFontHeight( long nHeight ) { SetFontSize( Size( mpImplFont->GetFontSize().Width(), nHeight ) ); }
671 long Font::GetFontHeight() const { return mpImplFont->GetFontSize().Height(); }
672 void Font::SetAverageFontWidth( long nWidth ) { SetFontSize( Size( nWidth, mpImplFont->GetFontSize().Height() ) ); }
674 
675 rtl_TextEncoding Font::GetCharSet() const { return mpImplFont->GetCharSet(); }
676 
681 
683 bool Font::IsVertical() const { return mpImplFont->mbVertical; }
685 
691 
697 
698 int Font::GetQuality() const { return mpImplFont->GetQuality(); }
699 void Font::SetQuality( int nQuality ) { mpImplFont->SetQuality( nQuality ); }
700 void Font::IncreaseQualityBy( int nQualityAmount ) { mpImplFont->IncreaseQualityBy( nQualityAmount ); }
701 void Font::DecreaseQualityBy( int nQualityAmount ) { mpImplFont->DecreaseQualityBy( nQualityAmount ); }
702 
703 bool Font::IsOutline() const { return mpImplFont->mbOutline; }
704 bool Font::IsShadow() const { return mpImplFont->mbShadow; }
710 bool Font::IsWordLineMode() const { return mpImplFont->mbWordLine; }
711 bool Font::IsSameInstance( const vcl::Font& rFont ) const { return (mpImplFont == rFont.mpImplFont); }
712 
713 
715  meWeight( WEIGHT_DONTKNOW ),
716  meFamily( FAMILY_DONTKNOW ),
717  mePitch( PITCH_DONTKNOW ),
718  meWidthType( WIDTH_DONTKNOW ),
719  meItalic( ITALIC_NONE ),
720  meAlign( ALIGN_TOP ),
721  meUnderline( LINESTYLE_NONE ),
722  meOverline( LINESTYLE_NONE ),
723  meStrikeout( STRIKEOUT_NONE ),
724  meRelief( FontRelief::NONE ),
725  meEmphasisMark( FontEmphasisMark::NONE ),
726  meKerning( FontKerning::FontSpecific ),
727  meCharSet( RTL_TEXTENCODING_DONTKNOW ),
728  maLanguageTag( LANGUAGE_DONTKNOW ),
729  maCJKLanguageTag( LANGUAGE_DONTKNOW ),
730  mbSymbolFlag( false ),
731  mbOutline( false ),
732  mbConfigLookup( false ),
733  mbShadow( false ),
734  mbVertical( false ),
735  mbTransparent( true ),
736  maColor( COL_TRANSPARENT ),
738  mbWordLine( false ),
739  mnOrientation( 0 ),
740  mnQuality( 0 )
741 {}
742 
743 ImplFont::ImplFont( const ImplFont& rImplFont ) :
744  maFamilyName( rImplFont.maFamilyName ),
745  maStyleName( rImplFont.maStyleName ),
746  meWeight( rImplFont.meWeight ),
747  meFamily( rImplFont.meFamily ),
748  mePitch( rImplFont.mePitch ),
749  meWidthType( rImplFont.meWidthType ),
750  meItalic( rImplFont.meItalic ),
751  meAlign( rImplFont.meAlign ),
752  meUnderline( rImplFont.meUnderline ),
753  meOverline( rImplFont.meOverline ),
754  meStrikeout( rImplFont.meStrikeout ),
755  meRelief( rImplFont.meRelief ),
756  meEmphasisMark( rImplFont.meEmphasisMark ),
757  meKerning( rImplFont.meKerning ),
758  maAverageFontSize( rImplFont.maAverageFontSize ),
759  meCharSet( rImplFont.meCharSet ),
760  maLanguageTag( rImplFont.maLanguageTag ),
761  maCJKLanguageTag( rImplFont.maCJKLanguageTag ),
762  mbSymbolFlag( rImplFont.mbSymbolFlag ),
763  mbOutline( rImplFont.mbOutline ),
764  mbConfigLookup( rImplFont.mbConfigLookup ),
765  mbShadow( rImplFont.mbShadow ),
766  mbVertical( rImplFont.mbVertical ),
767  mbTransparent( rImplFont.mbTransparent ),
768  maColor( rImplFont.maColor ),
769  maFillColor( rImplFont.maFillColor ),
770  mbWordLine( rImplFont.mbWordLine ),
771  mnOrientation( rImplFont.mnOrientation ),
772  mnQuality( rImplFont.mnQuality )
773 {}
774 
775 bool ImplFont::operator==( const ImplFont& rOther ) const
776 {
777  // equality tests split up for easier debugging
778  if( (meWeight != rOther.meWeight)
779  || (meItalic != rOther.meItalic)
780  || (meFamily != rOther.meFamily)
781  || (mePitch != rOther.mePitch) )
782  return false;
783 
784  if( (meCharSet != rOther.meCharSet)
785  || (maLanguageTag != rOther.maLanguageTag)
786  || (maCJKLanguageTag != rOther.maCJKLanguageTag)
787  || (meAlign != rOther.meAlign) )
788  return false;
789 
790  if( (maAverageFontSize != rOther.maAverageFontSize)
791  || (mnOrientation != rOther.mnOrientation)
792  || (mbVertical != rOther.mbVertical) )
793  return false;
794 
795  if( (maFamilyName != rOther.maFamilyName)
796  || (maStyleName != rOther.maStyleName) )
797  return false;
798 
799  if( (maColor != rOther.maColor)
800  || (maFillColor != rOther.maFillColor) )
801  return false;
802 
803  if( (meUnderline != rOther.meUnderline)
804  || (meOverline != rOther.meOverline)
805  || (meStrikeout != rOther.meStrikeout)
806  || (meRelief != rOther.meRelief)
807  || (meEmphasisMark != rOther.meEmphasisMark)
808  || (mbWordLine != rOther.mbWordLine)
809  || (mbOutline != rOther.mbOutline)
810  || (mbShadow != rOther.mbShadow)
811  || (meKerning != rOther.meKerning)
812  || (mbTransparent != rOther.mbTransparent) )
813  return false;
814 
815  return true;
816 }
817 
819 {
820  if( mbConfigLookup )
821  return;
822 
823  mbConfigLookup = true;
824 
825  // prepare the FontSubst configuration lookup
827 
828  OUString aShortName;
829  OUString aFamilyName;
830  ImplFontAttrs nType = ImplFontAttrs::None;
831  FontWeight eWeight = WEIGHT_DONTKNOW;
832  FontWidth eWidthType = WIDTH_DONTKNOW;
833  OUString aMapName = GetEnglishSearchFontName( maFamilyName );
834 
836  aShortName, aFamilyName, eWeight, eWidthType, nType );
837 
838  // lookup the font name in the configuration
839  const utl::FontNameAttr* pFontAttr = rFontSubst.getSubstInfo( aMapName );
840 
841  // if the direct lookup failed try again with an alias name
842  if ( !pFontAttr && (aShortName != aMapName) )
843  pFontAttr = rFontSubst.getSubstInfo( aShortName );
844 
845  if( pFontAttr )
846  {
847  // the font was found in the configuration
848  if( meFamily == FAMILY_DONTKNOW )
849  {
850  if ( pFontAttr->Type & ImplFontAttrs::Serif )
852  else if ( pFontAttr->Type & ImplFontAttrs::SansSerif )
854  else if ( pFontAttr->Type & ImplFontAttrs::Typewriter )
856  else if ( pFontAttr->Type & ImplFontAttrs::Italic )
858  else if ( pFontAttr->Type & ImplFontAttrs::Decorative )
860  }
861 
862  if( mePitch == PITCH_DONTKNOW )
863  {
864  if ( pFontAttr->Type & ImplFontAttrs::Fixed )
865  mePitch = PITCH_FIXED;
866  }
867  }
868 
869  // if some attributes are still unknown then use the FontSubst magic
870  if( meFamily == FAMILY_DONTKNOW )
871  {
872  if( nType & ImplFontAttrs::Serif )
874  else if( nType & ImplFontAttrs::SansSerif )
876  else if( nType & ImplFontAttrs::Typewriter )
878  else if( nType & ImplFontAttrs::Italic )
880  else if( nType & ImplFontAttrs::Decorative )
882  }
883 
884  if( GetWeight() == WEIGHT_DONTKNOW )
885  SetWeight( eWeight );
886  if( meWidthType == WIDTH_DONTKNOW )
887  meWidthType = eWidthType;
888 }
889 
890 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetFamily(FontFamily)
Definition: font/font.cxx:122
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SvStream & WriteBool(bool b)
long Width() const
Extra-light (Ultra-light)
Definition: sft.hxx:75
SvStream & ReadInt16(sal_Int16 &rInt16)
rtl_TextEncoding GetCharSet() const
Definition: impfont.hxx:50
FontKerning meKerning
Definition: impfont.hxx:106
void SetStrikeout(FontStrikeout)
Definition: font/font.cxx:256
#define FontAlign
Definition: font.hxx:35
void SetFillColor(const Color &)
Definition: font/font.cxx:87
static Font identifyFont(const void *pBuffer, sal_uInt32 nLen)
Definition: font/font.cxx:643
void SetAlignment(const TextAlign eAlignment)
Definition: impfont.hxx:63
FontStrikeout meStrikeout
Definition: impfont.hxx:103
void SetFontSize(const Size &)
Definition: font/font.cxx:116
50% of normal
Definition: sft.hxx:88
int GetQuality() const
Definition: impfont.hxx:77
Font & operator=(const Font &)
Definition: font/font.cxx:280
FontItalic meItalic
Definition: impfont.hxx:99
FontLineStyle meOverline
Definition: impfont.hxx:102
const OUString & GetFamilyName() const
Definition: font/font.cxx:666
void SetCharSet(const rtl_TextEncoding eCharSet)
Definition: impfont.hxx:64
FAMILY_SCRIPT
FontWidth meWidthType
Definition: impfont.hxx:98
void GetFontAttributes(FontAttributes &rAttrs) const
Definition: font/font.cxx:347
void SetAverageFontWidth(long nWidth)
Definition: font/font.cxx:672
TextAlign meAlign
Definition: impfont.hxx:100
FontWeight meWeight
Definition: impfont.hxx:95
SvStream & WriteUInt16(sal_uInt16 nUInt16)
const OUString & GetStyleName() const
Definition: impfont.hxx:43
void SetCJKContextLanguage(LanguageType)
Definition: font/font.cxx:179
LanguageTag & reset(const OUString &rBcp47LanguageTag)
long GetFontHeight() const
Definition: font/font.cxx:671
ImplFontAttrs Type
SFErrCodes OpenTTFontBuffer(const void *pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, TrueTypeFont **ttf)
TrueTypeFont constructor.
Definition: sft.cxx:1448
FAMILY_MODERN
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
Bold.
Definition: sft.hxx:80
const OUString & GetStyleName() const
Definition: font/font.cxx:667
Color maFillColor
Definition: impfont.hxx:123
long Height() const
bool IsOutline() const
Definition: font/font.cxx:703
FontWidth
LanguageType getLanguageType(bool bResolveSystem=true) const
void SetOverline(FontLineStyle)
Definition: font/font.cxx:250
FontLineStyle GetOverline() const
Definition: font/font.cxx:707
FontItalic GetItalic()
Definition: impfont.hxx:46
LanguageType GetCJKContextLanguage() const
Definition: font/font.cxx:680
const Size & GetFontSize() const
Definition: impfont.hxx:51
sal_uInt8 GetTransparency() const
void CloseTTFont(TrueTypeFont *ttf)
TrueTypeFont destructor.
Definition: sft.cxx:1694
void SetQuality(int nQuality)
Definition: impfont.hxx:79
FAMILY_DONTKNOW
void SetWidthType(const FontWidth eWidthType)
FontEmphasisMark
Black (Heavy)
Definition: sft.hxx:82
Return value of GetTTGlobalFontInfo()
Definition: sft.hxx:146
WEIGHT_THIN
SvStream & WriteFont(SvStream &rOStm, const vcl::Font &rFont)
Definition: font/font.cxx:447
SvStream & ReadCharAsBool(bool &rBool)
const FontNameAttr * getSubstInfo(const OUString &rFontName) const
FontRelief meRelief
Definition: impfont.hxx:104
Normal (Regular)
Definition: sft.hxx:77
FontWeight GetWeightNoAsk() const
Definition: impfont.hxx:71
FontFamily meFamily
Definition: impfont.hxx:96
WEIGHT_BLACK
void SetWeight(FontWeight)
Definition: font/font.cxx:214
void SetOutline(bool bOutline)
Definition: font/font.cxx:232
bool IsKerning() const
Definition: font/font.cxx:209
Medium.
Definition: sft.hxx:78
WEIGHT_SEMIBOLD
ImplFontAttrs
void SetPitch(const FontPitch ePitch)
void SetCharSet(rtl_TextEncoding)
Definition: font/font.cxx:128
FAMILY_ROMAN
sal_Unicode * usubfamily
subfamily name UCS2
Definition: sft.hxx:150
bool mbVertical
Definition: impfont.hxx:114
void SetOrientation(short nLineOrientation)
Definition: font/font.cxx:191
WEIGHT_LIGHT
bool operator<(const SwTextGlyphsKey &l, const SwTextGlyphsKey &r)
Semi-bold (Demi-bold)
Definition: sft.hxx:79
SvStream & WriteImplFont(SvStream &rOStm, const ImplFont &rImplFont)
Definition: font/font.cxx:406
FontFamily GetFamilyType()
Definition: font/font.cxx:690
FontAlign GetAlignment() const
Definition: font/font.cxx:664
void SetQuality(int)
Definition: font/font.cxx:699
WEIGHT_BOLD
Medium, 100%.
Definition: sft.hxx:92
LanguageType GetLanguage() const
Definition: font/font.cxx:679
const OUString & GetFamilyName() const
Definition: impfont.hxx:41
void SetFontSize(const Size &rSize)
Definition: impfont.hxx:65
void SetWidthType(const FontWidth eWidthType)
Definition: impfont.hxx:62
FontItalic GetItalic()
Definition: font/font.cxx:689
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
FontWidth GetWidthTypeNoAsk() const
Definition: impfont.hxx:74
void SetWeight(const FontWeight eWeight)
Definition: impfont.hxx:61
bool IsVertical() const
Definition: font/font.cxx:683
FontKerning GetKerning() const
Definition: font/font.cxx:684
FUNC_TYPE const nType
Size maAverageFontSize
Definition: impfont.hxx:107
LINESTYLE_NONE
75% of normal
Definition: sft.hxx:90
OUString GetEnglishSearchFontName(const OUString &rInName)
62.5% of normal
Definition: sft.hxx:89
void AskConfig()
Definition: font/font.cxx:818
SvStream & WriteUniOrByteString(const OUString &rStr, rtl_TextEncoding eDestCharSet)
bool IsSymbolFont() const
Definition: impfont.hxx:53
FontPitch GetPitchNoAsk() const
Definition: impfont.hxx:73
void IncreaseQualityBy(int nQualityAmount)
Definition: impfont.hxx:80
void SetPitch(const FontPitch ePitch)
Definition: impfont.hxx:59
const LanguageTag & GetLanguageTag() const
Definition: font/font.cxx:677
bool IsSymbolFont() const
Definition: font/font.cxx:141
void SetUnderline(FontLineStyle)
Definition: font/font.cxx:244
LanguageTag maCJKLanguageTag
Definition: impfont.hxx:111
FontWidth GetWidthType()
Definition: font/font.cxx:688
FAMILY_DECORATIVE
void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info)
Returns global font information about the TrueType font.
Definition: sft.cxx:2388
Extra-bold (Ultra-bold)
Definition: sft.hxx:81
FontKerning
Definition: fntstyle.hxx:28
FontEmphasisMark GetEmphasisMark() const
Definition: font/font.cxx:709
void SetLanguage(LanguageType)
Definition: font/font.cxx:173
void SetShadow(bool bShadow)
Definition: font/font.cxx:238
void SetPitch(FontPitch ePitch)
Definition: font/font.cxx:185
OUString maStyleName
Definition: impfont.hxx:94
rtl_TextEncoding GetStoreCharSet(rtl_TextEncoding eEncoding)
int GetQuality() const
Definition: font/font.cxx:698
FontFamily GetFamilyTypeNoAsk() const
Definition: impfont.hxx:70
FontWidth GetWidthType()
Definition: impfont.hxx:48
static void getMapName(const OUString &rOrgName, OUString &rShortName, OUString &rFamilyName, FontWeight &rWeight, FontWidth &rWidth, ImplFontAttrs &rType)
SvStream & ReadImplFont(SvStream &rIStm, ImplFont &rImplFont)
Definition: font/font.cxx:359
void SetRelief(FontRelief)
Definition: font/font.cxx:262
WEIGHT_DONTKNOW
void SetFamilyName(const OUString &sFamilyName)
Definition: impfont.hxx:55
void SetSymbolFlag(bool)
Definition: font/font.cxx:146
void SetAlignment(FontAlign)
Definition: font/font.cxx:100
NONE
void DecreaseQualityBy(int nQualityAmount)
Definition: impfont.hxx:81
virtual ~Font()
Definition: font/font.cxx:75
bool operator==(const ImplFont &) const
Definition: font/font.cxx:775
static FontSubstConfiguration & get()
void SetFamilyName(const OUString &rFamilyName)
Definition: font/font.cxx:106
void SetWeight(const FontWeight eWeight)
FontEmphasisMark meEmphasisMark
Definition: impfont.hxx:105
FontPitch GetPitch()
Definition: font/font.cxx:686
sal_uInt16 GetVersion() const
rtl_TextEncoding meCharSet
Definition: impfont.hxx:108
void SetCJKContextLanguageTag(const LanguageTag &)
Definition: font/font.cxx:167
112.5% of normal
Definition: sft.hxx:93
LanguageTag maLanguageTag
Definition: impfont.hxx:110
void SetKerning(FontKerning nKerning)
Definition: font/font.cxx:203
void SetItalic(const FontItalic eItalic)
void SetFamilyName(const OUString &sFamilyName)
WEIGHT_MEDIUM
150% of normal
Definition: sft.hxx:95
bool mbConfigLookup
Definition: impfont.hxx:114
void SetWordLineMode(bool bWordLine)
Definition: font/font.cxx:274
bool IsWordLineMode() const
Definition: font/font.cxx:710
void SetSymbolFlag(const bool bSymbolFlag)
Definition: impfont.hxx:67
void SetSymbolFlag(const bool)
void IncreaseQualityBy(int)
Definition: font/font.cxx:700
FontItalic GetItalicNoAsk() const
Definition: impfont.hxx:72
int width
value of WidthClass or 0 if can't be determined
Definition: sft.hxx:154
Color maColor
Definition: impfont.hxx:122
bool IsShadow() const
Definition: font/font.cxx:704
#define LANGUAGE_DONTKNOW
void Merge(const Font &rFont)
Definition: font/font.cxx:297
PITCH_DONTKNOW
const Size & GetFontSize() const
Definition: font/font.cxx:669
FontStrikeout GetStrikeout() const
Definition: font/font.cxx:708
void SetWidthType(FontWidth)
Definition: font/font.cxx:220
SvStream & ReadUChar(unsigned char &rChar)
TextAlign GetAlignment() const
Definition: impfont.hxx:49
WEIGHT_ULTRABOLD
Light.
Definition: sft.hxx:76
SvStream & WritePair(SvStream &rOStream, const Pair &rPair)
const Color & GetFillColor() const
Definition: font/font.cxx:661
200% of normal
Definition: sft.hxx:96
FontPitch
LINESTYLE_DONTKNOW
void SetColor(const Color &)
Definition: font/font.cxx:79
short mnOrientation
Definition: impfont.hxx:129
FontWeight GetWeight()
Definition: impfont.hxx:45
uno::Sequence< double > maFillColor
bool mbShadow
Definition: impfont.hxx:114
87.5% of normal
Definition: sft.hxx:91
FontFamily
FontRelief GetRelief() const
Definition: font/font.cxx:705
FontPitch GetPitch()
Definition: impfont.hxx:47
const LanguageTag & GetCJKContextLanguageTag() const
Definition: font/font.cxx:678
ALIGN_TOP
FontPitch mePitch
Definition: impfont.hxx:97
void SetEmphasisMark(FontEmphasisMark)
Definition: font/font.cxx:268
const Color & GetColor() const
Definition: font/font.cxx:660
short GetOrientation() const
Definition: font/font.cxx:682
FontWeight
void SetStyleName(const OUString &rStyleName)
Definition: font/font.cxx:111
void DecreaseQualityBy(int)
Definition: font/font.cxx:701
void SetStyleName(const OUString &sStyleName)
Definition: impfont.hxx:56
FontWeight GetWeight()
Definition: font/font.cxx:687
unsigned char sal_uInt8
WIDTH_DONTKNOW
bool mbTransparent
Definition: impfont.hxx:114
SvStream & ReadFont(SvStream &rIStm, vcl::Font &rFont)
Definition: font/font.cxx:442
void SetTransparent(bool bTransparent)
Definition: font/font.cxx:94
int weight
value of WeightClass or 0 if can't be determined
Definition: sft.hxx:153
bool operator==(const Font &) const
Definition: font/font.cxx:292
FAMILY_SWISS
SvStream & WriteUChar(unsigned char nChar)
Sun Font Tools.
bool IsTransparent() const
Definition: font/font.cxx:662
void SetLanguageTag(const LanguageTag &)
Definition: font/font.cxx:161
ITALIC_DONTKNOW
SvStream & WriteInt16(sal_Int16 nInt16)
rtl_TextEncoding GetStreamCharSet() const
125% of normal
Definition: sft.hxx:94
void SetFontHeight(long nHeight)
Definition: font/font.cxx:670
sal_Unicode * ufamily
family name UCS2
Definition: sft.hxx:148
void SetStyleName(const OUString &sStyleName)
ImplType mpImplFont
Definition: font.hxx:169
void SetFamilyType(const FontFamily eFontFamily)
Definition: impfont.hxx:57
FontFamily GetFamilyType()
Definition: impfont.hxx:42
bool mbWordLine
Definition: impfont.hxx:126
void SetVertical(bool bVertical)
Definition: font/font.cxx:197
bool IsSameInstance(const Font &) const
Definition: font/font.cxx:711
void SetItalic(FontItalic)
Definition: font/font.cxx:226
STRIKEOUT_DONTKNOW
FontLineStyle GetUnderline() const
Definition: font/font.cxx:706
OUString maFamilyName
Definition: impfont.hxx:93
char * subfamily
subfamily name
Definition: sft.hxx:149
int italicAngle
in counter-clockwise degrees * 65536
Definition: sft.hxx:156
sal_uInt16 macStyle
macstyle bits from 'HEAD' table
Definition: sft.hxx:152
void SetItalic(const FontItalic eItalic)
Definition: impfont.hxx:60
char * family
family name
Definition: sft.hxx:147
STRIKEOUT_NONE
int pitch
0: proportional font, otherwise: monospaced
Definition: sft.hxx:155
SvStream & ReadPair(SvStream &rIStream, Pair &rPair)
long GetAverageFontWidth() const
Definition: font/font.cxx:673
FontLineStyle
bool mbOutline
Definition: impfont.hxx:114
FontStrikeout
FontLineStyle meUnderline
Definition: impfont.hxx:101
FontRelief
Definition: fntstyle.hxx:26
rtl_TextEncoding GetCharSet() const
Definition: font/font.cxx:675
void SetFamilyType(const FontFamily eFontFamily)
FontItalic
OUString ReadUniOrByteString(rtl_TextEncoding eSrcCharSet)