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