MWAWFont.hxx Source File documentation

MWAWFont.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3/* libmwaw
4* Version: MPL 2.0 / LGPLv2+
5*
6* The contents of this file are subject to the Mozilla Public License Version
7* 2.0 (the "License"); you may not use this file except in compliance with
8* the License or as specified alternatively below. You may obtain a copy of
9* the License at http://www.mozilla.org/MPL/
10*
11* Software distributed under the License is distributed on an "AS IS" basis,
12* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13* for the specific language governing rights and limitations under the
14* License.
15*
16* Major Contributor(s):
17* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20* Copyright (C) 2006, 2007 Andrew Ziem
21* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22*
23*
24* All Rights Reserved.
25*
26* For minor contributions see the git repository.
27*
28* Alternatively, the contents of this file may be used under the terms of
29* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30* in which case the provisions of the LGPLv2+ are applicable
31* instead of those above.
32*/
33
34#ifndef MWAW_FONT
35# define MWAW_FONT
36
37#include <string>
38#include <vector>
39
40#include "libmwaw_internal.hxx"
41
43 class MWAWFont
44{
45public:
47 struct Line {
49 enum Style { None, Simple, Dot, LargeDot, Dash, Wave };
51 enum Type { Single, Double, Triple };
53 explicit Line(Style style=None, Type type=Single, bool wordFlag=false, float w=1.0)
54 : m_style(style)
55 , m_type(type)
56 , m_width(w)
57 , m_color(MWAWColor::black())
58 , m_word(wordFlag)
59 {
60 }
62 bool isSet() const
63 {
64 return m_style != None && m_width>0;
65 }
67 void addTo(librevenge::RVNGPropertyList &propList, std::string const &type) const;
69 friend std::ostream &operator<<(std::ostream &o, Line const &line);
71 bool operator==(Line const &oth) const
72 {
73 return cmp(oth)==0;
74 }
76 bool operator!=(Line const &oth) const
77 {
78 return cmp(oth)!=0;
79 }
81 int cmp(Line const &oth) const
82 {
83 if (m_style != oth.m_style) return int(m_style)-int(oth.m_style);
84 if (m_type != oth.m_type) return int(m_type)-int(oth.m_type);
85 if (m_word != oth.m_word) return m_word ? -1 : 1;
86 if (m_width < oth.m_width) return -1;
87 if (m_width > oth.m_width) return 1;
88 if (m_color.isSet() != oth.m_color.isSet())
89 return m_color.isSet();
90 if (m_color.get() < oth.m_color.get()) return -1;
91 if (m_color.get() > oth.m_color.get()) return 1;
92 return 0;
93 }
95 Style m_style;
97 Type m_type;
99 float m_width;
101 MWAWVariable<MWAWColor> m_color;
103 bool m_word;
104 };
106 struct Script {
108 explicit Script(float delta=0, librevenge::RVNGUnit deltaUnit=librevenge::RVNG_PERCENT, int scale=100)
109 : m_delta(delta)
110 , m_deltaUnit(deltaUnit)
111 , m_scale(scale)
112 {
113 }
115 bool isSet() const
116 {
117 return *this != Script();
118 }
120 static Script sub()
121 {
122 return Script(-33,librevenge::RVNG_PERCENT,58);
123 }
125 static Script sub100()
126 {
127 return Script(-20);
128 }
130 static Script super()
131 {
132 return Script(33,librevenge::RVNG_PERCENT,58);
133 }
135 static Script super100()
136 {
137 return Script(20);
138 }
140 std::string str(float fSize) const;
141
143 bool operator==(Script const &oth) const
144 {
145 return cmp(oth)==0;
146 }
148 bool operator!=(Script const &oth) const
149 {
150 return cmp(oth)!=0;
151 }
153 bool operator<(Script const &oth) const
154 {
155 return cmp(oth)<0;
156 }
158 bool operator<=(Script const &oth) const
159 {
160 return cmp(oth)<=0;
161 }
163 bool operator>(Script const &oth) const
164 {
165 return cmp(oth)>0;
166 }
168 bool operator>=(Script const &oth) const
169 {
170 return cmp(oth)>=0;
171 }
173 int cmp(Script const &oth) const
174 {
175 if (m_delta > oth.m_delta) return -1;
176 if (m_delta < oth.m_delta) return 1;
177 if (m_deltaUnit != oth.m_deltaUnit) return int(m_deltaUnit)-int(oth.m_deltaUnit);
178 if (m_scale != oth.m_scale) return m_scale-oth.m_scale;
179 return 0;
180 }
182 float m_delta;
184 librevenge::RVNGUnit m_deltaUnit;
186 int m_scale;
187 };
188
190 enum FontBits { boldBit=1, italicBit=2, blinkBit=4, embossBit=8, engraveBit=0x10,
191 hiddenBit=0x20, outlineBit=0x40, shadowBit=0x80,
192 reverseVideoBit=0x100, smallCapsBit=0x200, uppercaseBit=0x400,
193 lowercaseBit=0x800,
194 initialcaseBit=2*lowercaseBit,
195 boxedBit=2*initialcaseBit,
196 boxedRoundedBit=2*boxedBit,
197 reverseWritingBit=2*boxedRoundedBit
198 };
204 explicit MWAWFont(int newId=-1, float sz=12, uint32_t f = 0)
205 : m_id(newId)
206 , m_size(sz)
207 , m_sizeIsRelative(false)
208 , m_deltaSpacing(0)
209 , m_deltaSpacingUnit(librevenge::RVNG_POINT)
210 , m_widthStreching(1)
211 , m_scriptPosition()
212 , m_flags(f)
213 , m_overline(Line(Line::None))
214 , m_strikeoutline(Line(Line::None))
215 , m_underline(Line(Line::None))
216 , m_color(MWAWColor::black())
217 , m_backgroundColor(MWAWColor::white())
218 , m_language("")
219 , m_extra("")
220 {
221 resetColor();
222 }
224 bool isSet() const
225 {
226 return m_id.isSet();
227 }
229 void insert(MWAWFont const &ft)
230 {
231 m_id.insert(ft.m_id);
232 m_size.insert(ft.m_size);
233 m_sizeIsRelative.insert(ft.m_sizeIsRelative);
234 m_deltaSpacing.insert(ft.m_deltaSpacing);
235 m_deltaSpacingUnit.insert(ft.m_deltaSpacingUnit);
236 m_widthStreching.insert(ft.m_widthStreching);
237 m_scriptPosition.insert(ft.m_scriptPosition);
238 if (ft.m_flags.isSet()) {
239 if (m_flags.isSet())
240 setFlags(flags()| ft.flags());
241 else
242 m_flags = ft.m_flags;
243 }
244 m_overline.insert(ft.m_overline);
245 m_strikeoutline.insert(ft.m_strikeoutline);
246 m_underline.insert(ft.m_underline);
247 m_color.insert(ft.m_color);
248 m_backgroundColor.insert(ft.m_backgroundColor);
249 m_extra += ft.m_extra;
250 }
252 void setFont(int newId)
253 {
254 resetColor();
255 m_id=newId;
256 }
257
259 int id() const
260 {
261 return m_id.get();
262 }
264 void setId(int newId)
265 {
266 m_id = newId;
267 }
268
270 float size() const
271 {
272 return m_size.get();
273 }
275 void setSize(float sz, bool isRelative=false)
276 {
277 m_size = sz;
278 m_sizeIsRelative = isRelative;
279 }
280
282 float deltaLetterSpacing() const
283 {
284 return m_deltaSpacing.get();
285 }
287 librevenge::RVNGUnit deltaLetterSpacingUnit() const
288 {
289 return m_deltaSpacingUnit.get();
290 }
292 void setDeltaLetterSpacing(float d, librevenge::RVNGUnit unit=librevenge::RVNG_POINT)
293 {
294 m_deltaSpacing=d;
295 m_deltaSpacingUnit=unit;
296 }
298 float widthStreching() const
299 {
300 return m_widthStreching.get();
301 }
303 void setWidthStreching(float scale=1.0)
304 {
305 m_widthStreching = scale;
306 }
308 Script const &script() const
309 {
310 return m_scriptPosition.get();
311 }
312
314 void set(Script const &newscript)
315 {
316 m_scriptPosition = newscript;
317 }
318
320 uint32_t flags() const
321 {
322 return m_flags.get();
323 }
325 void setFlags(uint32_t fl)
326 {
327 m_flags = fl;
328 }
329
331 bool hasColor() const
332 {
333 return m_color.isSet() && !m_color.get().isBlack();
334 }
336 void getColor(MWAWColor &c) const
337 {
338 c = m_color.get();
339 }
341 void setColor(MWAWColor color)
342 {
343 m_color = color;
344 }
345
347 void getBackgroundColor(MWAWColor &c) const
348 {
349 c = m_backgroundColor.get();
350 }
352 void setBackgroundColor(MWAWColor color)
353 {
354 m_backgroundColor = color;
355 }
357 void resetColor()
358 {
359 m_color = MWAWColor::black();
360 m_backgroundColor = MWAWColor::white();
361 }
362
364 bool hasDecorationLines() const
365 {
366 return (m_overline.isSet() && m_overline->isSet()) ||
367 (m_strikeoutline.isSet() && m_strikeoutline->isSet()) ||
368 (m_underline.isSet() && m_underline->isSet());
369 }
371 void resetDecorationLines()
372 {
373 if (m_overline.isSet()) m_overline=Line(Line::None);
374 if (m_strikeoutline.isSet()) m_strikeoutline=Line(Line::None);
375 if (m_underline.isSet()) m_underline=Line(Line::None);
376 }
378 Line const &getOverline() const
379 {
380 return m_overline.get();
381 }
383 void setOverline(Line const &line)
384 {
385 m_overline = line;
386 }
388 void setOverlineStyle(Line::Style style=Line::None, bool doReset=true)
389 {
390 if (doReset)
391 m_overline = Line(style);
392 else
393 m_overline->m_style = style;
394 }
396 void setOverlineType(Line::Type type=Line::Single)
397 {
398 m_overline->m_type = type;
399 }
401 void setOverlineWordFlag(bool wordFlag=false)
402 {
403 m_overline->m_word = wordFlag;
404 }
406 void setOverlineWidth(float w)
407 {
408 m_overline->m_width = w;
409 }
411 void setOverlineColor(MWAWColor const &color)
412 {
413 m_overline->m_color = color;
414 }
415
417 Line const &getStrikeOut() const
418 {
419 return m_strikeoutline.get();
420 }
422 void setStrikeOut(Line const &line)
423 {
424 m_strikeoutline = line;
425 }
427 void setStrikeOutStyle(Line::Style style=Line::None, bool doReset=true)
428 {
429 if (doReset)
430 m_strikeoutline = Line(style);
431 else
432 m_strikeoutline->m_style = style;
433 }
435 void setStrikeOutType(Line::Type type=Line::Single)
436 {
437 m_strikeoutline->m_type = type;
438 }
440 void setStrikeOutWordFlag(bool wordFlag=false)
441 {
442 m_strikeoutline->m_word = wordFlag;
443 }
445 void setStrikeOutWidth(float w)
446 {
447 m_strikeoutline->m_width = w;
448 }
450 void setStrikeOutColor(MWAWColor const &color)
451 {
452 m_strikeoutline->m_color = color;
453 }
454
456 Line const &getUnderline() const
457 {
458 return m_underline.get();
459 }
461 void setUnderline(Line const &line)
462 {
463 m_underline = line;
464 }
466 void setUnderlineStyle(Line::Style style=Line::None, bool doReset=true)
467 {
468 if (doReset)
469 m_underline = Line(style);
470 else
471 m_underline->m_style = style;
472 }
474 void setUnderlineType(Line::Type type=Line::Single)
475 {
476 m_underline->m_type = type;
477 }
479 void setUnderlineWordFlag(bool wordFlag=false)
480 {
481 m_underline->m_word = wordFlag;
482 }
484 void setUnderlineWidth(float w)
485 {
486 m_underline->m_width = w;
487 }
489 void setUnderlineColor(MWAWColor const &color)
490 {
491 m_underline->m_color = color;
492 }
493
495 std::string const &language() const
496 {
497 return m_language.get();
498 }
500 void setLanguage(std::string const &lang)
501 {
502 m_language=lang;
503 }
505 void addTo(librevenge::RVNGPropertyList &propList, std::shared_ptr<MWAWFontConverter> fontConverter) const;
507 void addToListLevel(librevenge::RVNGPropertyList &propList, std::shared_ptr<MWAWFontConverter> fontConverter) const;
508
510 std::string getDebugString(std::shared_ptr<MWAWFontConverter> &converter) const;
511
513 bool operator==(MWAWFont const &f) const
514 {
515 return cmp(f) == 0;
516 }
518 bool operator!=(MWAWFont const &f) const
519 {
520 return cmp(f) != 0;
521 }
522
524 int cmp(MWAWFont const &oth) const
525 {
526 int diff = id() - oth.id();
527 if (diff != 0) return diff;
528 if (size() < oth.size()) return -1;
529 if (size() > oth.size()) return 1;
530 if (m_sizeIsRelative.get() != oth.m_sizeIsRelative.get()) return m_sizeIsRelative.get() ? 1 : -1;
531 if (flags() < oth.flags()) return -1;
532 if (flags() > oth.flags()) return 1;
533 if (m_deltaSpacing.get() < oth.m_deltaSpacing.get()) return -1;
534 if (m_deltaSpacing.get() > oth.m_deltaSpacing.get()) return 1;
535 if (m_deltaSpacingUnit.get() < oth.m_deltaSpacingUnit.get()) return -1;
536 if (m_deltaSpacingUnit.get() > oth.m_deltaSpacingUnit.get()) return 1;
537 if (m_widthStreching.get() < oth.m_widthStreching.get()) return -1;
538 if (m_widthStreching.get() > oth.m_widthStreching.get()) return 1;
539 diff = script().cmp(oth.script());
540 if (diff != 0) return diff;
541 diff = m_overline.get().cmp(oth.m_overline.get());
542 if (diff != 0) return diff;
543 diff = m_strikeoutline.get().cmp(oth.m_strikeoutline.get());
544 if (diff != 0) return diff;
545 diff = m_underline.get().cmp(oth.m_underline.get());
546 if (diff != 0) return diff;
547 if (m_color.get() < oth.m_color.get()) return -1;
548 if (m_color.get() > oth.m_color.get()) return 1;
549 if (m_backgroundColor.get() < oth.m_backgroundColor.get()) return -1;
550 if (m_backgroundColor.get() > oth.m_backgroundColor.get()) return 1;
551 if (m_language.get() < oth.m_language.get()) return -1;
552 if (m_language.get() > oth.m_language.get()) return 1;
553 return diff;
554 }
555
556protected:
557 MWAWVariable<int> m_id ;
558 MWAWVariable<float> m_size ;
559 MWAWVariable<bool> m_sizeIsRelative ;
560 MWAWVariable<float> m_deltaSpacing ;
561 MWAWVariable<librevenge::RVNGUnit> m_deltaSpacingUnit ;
562 MWAWVariable<float> m_widthStreching ;
563 MWAWVariable<Script> m_scriptPosition ;
564 MWAWVariable<uint32_t> m_flags ;
565 MWAWVariable<Line> m_overline ;
566 MWAWVariable<Line> m_strikeoutline ;
567 MWAWVariable<Line> m_underline ;
568 MWAWVariable<MWAWColor> m_color ;
569 MWAWVariable<MWAWColor> m_backgroundColor ;
570 MWAWVariable<std::string> m_language ;
571public:
573 std::string m_extra;
574};
575
576namespace MWAWFontManagerInternal
577{
578struct State;
579}
580
582 class MWAWFontManager
583{
584public:
586 explicit MWAWFontManager(std::shared_ptr<MWAWFontConverter> const &fontConverter);
588 ~MWAWFontManager();
590 int getId(MWAWFont const &font);
592 bool getFont(int id, MWAWFont &font) const;
594 std::shared_ptr<MWAWFontConverter> getFontConverter();
595protected:
597 std::shared_ptr<MWAWFontManagerInternal::State> m_state;
598private:
599 MWAWFontManager(MWAWFontManager const &) = delete;
600 MWAWFontManager &operator=(MWAWFontManager const &) = delete;
601};
602#endif
603// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWFontManager
a font manager which can be used to store fonts, ...
Definition: MWAWFont.hxx:583
MWAWFontManager::getId
int getId(MWAWFont const &font)
returns a span id which can be used to call the list
Definition: MWAWFont.cxx:435
MWAWFontManager::operator=
MWAWFontManager & operator=(MWAWFontManager const &)=delete
MWAWFontManager::~MWAWFontManager
~MWAWFontManager()
destructor
Definition: MWAWFont.cxx:426
MWAWFontManager::getFontConverter
std::shared_ptr< MWAWFontConverter > getFontConverter()
returns the font converter
Definition: MWAWFont.cxx:430
MWAWFontManager::MWAWFontManager
MWAWFontManager(MWAWFontManager const &)=delete
MWAWFontManager::getFont
bool getFont(int id, MWAWFont &font) const
returns the font corresponding to an id
Definition: MWAWFont.cxx:446
MWAWFontManager::m_state
std::shared_ptr< MWAWFontManagerInternal::State > m_state
the state
Definition: MWAWFont.hxx:597
MWAWFontManager::MWAWFontManager
MWAWFontManager(std::shared_ptr< MWAWFontConverter > const &fontConverter)
constructor
Definition: MWAWFont.cxx:421
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:44
MWAWFont::m_scriptPosition
MWAWVariable< Script > m_scriptPosition
the sub/super script definition
Definition: MWAWFont.hxx:563
MWAWFont::setWidthStreching
void setWidthStreching(float scale=1.0)
sets the text width streching
Definition: MWAWFont.hxx:303
MWAWFont::setUnderlineColor
void setUnderlineColor(MWAWColor const &color)
sets the underline color
Definition: MWAWFont.hxx:489
MWAWFont::setFont
void setFont(int newId)
sets the font id and resets size to the previous size for this font
Definition: MWAWFont.hxx:252
MWAWFont::flags
uint32_t flags() const
returns the font flags
Definition: MWAWFont.hxx:320
MWAWFont::getStrikeOut
Line const & getStrikeOut() const
returns the strikeoutline
Definition: MWAWFont.hxx:417
MWAWFont::getBackgroundColor
void getBackgroundColor(MWAWColor &c) const
returns the font background color
Definition: MWAWFont.hxx:347
MWAWFont::insert
void insert(MWAWFont const &ft)
inserts the set value in the current font
Definition: MWAWFont.hxx:229
MWAWFont::setOverlineWordFlag
void setOverlineWordFlag(bool wordFlag=false)
sets the overline word flag
Definition: MWAWFont.hxx:401
MWAWFont::FontBits
FontBits
the different font bit
Definition: MWAWFont.hxx:190
MWAWFont::shadowBit
@ shadowBit
Definition: MWAWFont.hxx:191
MWAWFont::outlineBit
@ outlineBit
Definition: MWAWFont.hxx:191
MWAWFont::boxedBit
@ boxedBit
Definition: MWAWFont.hxx:195
MWAWFont::uppercaseBit
@ uppercaseBit
Definition: MWAWFont.hxx:192
MWAWFont::smallCapsBit
@ smallCapsBit
Definition: MWAWFont.hxx:192
MWAWFont::reverseVideoBit
@ reverseVideoBit
Definition: MWAWFont.hxx:192
MWAWFont::embossBit
@ embossBit
Definition: MWAWFont.hxx:190
MWAWFont::hiddenBit
@ hiddenBit
Definition: MWAWFont.hxx:191
MWAWFont::boldBit
@ boldBit
Definition: MWAWFont.hxx:190
MWAWFont::lowercaseBit
@ lowercaseBit
Definition: MWAWFont.hxx:193
MWAWFont::reverseWritingBit
@ reverseWritingBit
Definition: MWAWFont.hxx:197
MWAWFont::initialcaseBit
@ initialcaseBit
Definition: MWAWFont.hxx:194
MWAWFont::italicBit
@ italicBit
Definition: MWAWFont.hxx:190
MWAWFont::boxedRoundedBit
@ boxedRoundedBit
Definition: MWAWFont.hxx:196
MWAWFont::blinkBit
@ blinkBit
Definition: MWAWFont.hxx:190
MWAWFont::engraveBit
@ engraveBit
Definition: MWAWFont.hxx:190
MWAWFont::setStrikeOutStyle
void setStrikeOutStyle(Line::Style style=Line::None, bool doReset=true)
sets the strikeoutline style ( by default, we also reset the style)
Definition: MWAWFont.hxx:427
MWAWFont::size
float size() const
returns the font size
Definition: MWAWFont.hxx:270
MWAWFont::setUnderline
void setUnderline(Line const &line)
sets the underline
Definition: MWAWFont.hxx:461
MWAWFont::m_backgroundColor
MWAWVariable< MWAWColor > m_backgroundColor
font background color
Definition: MWAWFont.hxx:569
MWAWFont::m_color
MWAWVariable< MWAWColor > m_color
font color
Definition: MWAWFont.hxx:568
MWAWFont::script
Script const & script() const
returns the script position
Definition: MWAWFont.hxx:308
MWAWFont::id
int id() const
returns the font id
Definition: MWAWFont.hxx:259
MWAWFont::setUnderlineWordFlag
void setUnderlineWordFlag(bool wordFlag=false)
sets the underline word flag
Definition: MWAWFont.hxx:479
MWAWFont::addToListLevel
void addToListLevel(librevenge::RVNGPropertyList &propList, std::shared_ptr< MWAWFontConverter > fontConverter) const
add to the propList to a list level
Definition: MWAWFont.cxx:360
MWAWFont::deltaLetterSpacingUnit
librevenge::RVNGUnit deltaLetterSpacingUnit() const
returns the condensed(negative)/extended(positive) unit
Definition: MWAWFont.hxx:287
MWAWFont::addTo
void addTo(librevenge::RVNGPropertyList &propList, std::shared_ptr< MWAWFontConverter > fontConverter) const
add to the propList
Definition: MWAWFont.cxx:245
MWAWFont::getDebugString
std::string getDebugString(std::shared_ptr< MWAWFontConverter > &converter) const
returns a string which can be used for debugging
Definition: MWAWFont.cxx:181
MWAWFont::setFlags
void setFlags(uint32_t fl)
sets the font attributes bold, ...
Definition: MWAWFont.hxx:325
MWAWFont::setBackgroundColor
void setBackgroundColor(MWAWColor color)
sets the font background color
Definition: MWAWFont.hxx:352
MWAWFont::cmp
int cmp(MWAWFont const &oth) const
a comparison function
Definition: MWAWFont.hxx:524
MWAWFont::operator==
bool operator==(MWAWFont const &f) const
operator==
Definition: MWAWFont.hxx:513
MWAWFont::m_size
MWAWVariable< float > m_size
font size
Definition: MWAWFont.hxx:558
MWAWFont::setUnderlineStyle
void setUnderlineStyle(Line::Style style=Line::None, bool doReset=true)
sets the underline style ( by default, we also reset the style)
Definition: MWAWFont.hxx:466
MWAWFont::setUnderlineType
void setUnderlineType(Line::Type type=Line::Single)
sets the underline type
Definition: MWAWFont.hxx:474
MWAWFont::MWAWFont
MWAWFont(int newId=-1, float sz=12, uint32_t f=0)
constructor
Definition: MWAWFont.hxx:204
MWAWFont::getUnderline
Line const & getUnderline() const
returns the underline
Definition: MWAWFont.hxx:456
MWAWFont::setStrikeOutWidth
void setStrikeOutWidth(float w)
sets the strikeoutline width
Definition: MWAWFont.hxx:445
MWAWFont::m_sizeIsRelative
MWAWVariable< bool > m_sizeIsRelative
true if the size is percent
Definition: MWAWFont.hxx:559
MWAWFont::setColor
void setColor(MWAWColor color)
sets the font color
Definition: MWAWFont.hxx:341
MWAWFont::m_deltaSpacingUnit
MWAWVariable< librevenge::RVNGUnit > m_deltaSpacingUnit
the delta spacing unit
Definition: MWAWFont.hxx:561
MWAWFont::setStrikeOutColor
void setStrikeOutColor(MWAWColor const &color)
sets the strikeoutline color
Definition: MWAWFont.hxx:450
MWAWFont::m_id
MWAWVariable< int > m_id
font identificator
Definition: MWAWFont.hxx:557
MWAWFont::m_widthStreching
MWAWVariable< float > m_widthStreching
the width streching in percent
Definition: MWAWFont.hxx:562
MWAWFont::operator!=
bool operator!=(MWAWFont const &f) const
operator!=
Definition: MWAWFont.hxx:518
MWAWFont::setStrikeOut
void setStrikeOut(Line const &line)
sets the strikeoutline
Definition: MWAWFont.hxx:422
MWAWFont::setStrikeOutType
void setStrikeOutType(Line::Type type=Line::Single)
sets the strikeoutline type
Definition: MWAWFont.hxx:435
MWAWFont::m_overline
MWAWVariable< Line > m_overline
overline attributes
Definition: MWAWFont.hxx:565
MWAWFont::m_strikeoutline
MWAWVariable< Line > m_strikeoutline
overline attributes
Definition: MWAWFont.hxx:566
MWAWFont::m_deltaSpacing
MWAWVariable< float > m_deltaSpacing
expand(> 0), condensed(< 0) depl
Definition: MWAWFont.hxx:560
MWAWFont::resetColor
void resetColor()
resets the font color to black and the background color to white
Definition: MWAWFont.hxx:357
MWAWFont::setLanguage
void setLanguage(std::string const &lang)
set the language ( in the for en_US, en_GB, en, ...)
Definition: MWAWFont.hxx:500
MWAWFont::setOverlineType
void setOverlineType(Line::Type type=Line::Single)
sets the overline type
Definition: MWAWFont.hxx:396
MWAWFont::setDeltaLetterSpacing
void setDeltaLetterSpacing(float d, librevenge::RVNGUnit unit=librevenge::RVNG_POINT)
sets the letter spacing ( delta value in point )
Definition: MWAWFont.hxx:292
MWAWFont::hasColor
bool hasColor() const
returns true if the font color is not black
Definition: MWAWFont.hxx:331
MWAWFont::setSize
void setSize(float sz, bool isRelative=false)
sets the font size
Definition: MWAWFont.hxx:275
MWAWFont::deltaLetterSpacing
float deltaLetterSpacing() const
returns the condensed(negative)/extended(positive) width
Definition: MWAWFont.hxx:282
MWAWFont::setOverlineColor
void setOverlineColor(MWAWColor const &color)
sets the overline color
Definition: MWAWFont.hxx:411
MWAWFont::m_language
MWAWVariable< std::string > m_language
the language if set
Definition: MWAWFont.hxx:570
MWAWFont::resetDecorationLines
void resetDecorationLines()
reset the decoration
Definition: MWAWFont.hxx:371
MWAWFont::m_underline
MWAWVariable< Line > m_underline
underline attributes
Definition: MWAWFont.hxx:567
MWAWFont::isSet
bool isSet() const
returns true if the font id is initialized
Definition: MWAWFont.hxx:224
MWAWFont::hasDecorationLines
bool hasDecorationLines() const
return true if the font has decorations line (overline, strikeout, underline)
Definition: MWAWFont.hxx:364
MWAWFont::widthStreching
float widthStreching() const
returns the text width streching
Definition: MWAWFont.hxx:298
MWAWFont::setOverlineWidth
void setOverlineWidth(float w)
sets the overline width
Definition: MWAWFont.hxx:406
MWAWFont::m_extra
std::string m_extra
extra data
Definition: MWAWFont.hxx:573
MWAWFont::language
std::string const & language() const
returns the language
Definition: MWAWFont.hxx:495
MWAWFont::set
void set(Script const &newscript)
sets the script position
Definition: MWAWFont.hxx:314
MWAWFont::getOverline
Line const & getOverline() const
returns the overline
Definition: MWAWFont.hxx:378
MWAWFont::getColor
void getColor(MWAWColor &c) const
returns the font color
Definition: MWAWFont.hxx:336
MWAWFont::setId
void setId(int newId)
sets the font id
Definition: MWAWFont.hxx:264
MWAWFont::setUnderlineWidth
void setUnderlineWidth(float w)
sets the underline width
Definition: MWAWFont.hxx:484
MWAWFont::setOverline
void setOverline(Line const &line)
sets the overline
Definition: MWAWFont.hxx:383
MWAWFont::setOverlineStyle
void setOverlineStyle(Line::Style style=Line::None, bool doReset=true)
sets the overline style ( by default, we also reset the style)
Definition: MWAWFont.hxx:388
MWAWFont::setStrikeOutWordFlag
void setStrikeOutWordFlag(bool wordFlag=false)
sets the strikeoutline word flag
Definition: MWAWFont.hxx:440
MWAWFont::m_flags
MWAWVariable< uint32_t > m_flags
font attributes
Definition: MWAWFont.hxx:564
libmwaw_internal.hxx
MWAWFontManagerInternal
namespace used to define structure for the font manager
Definition: MWAWFont.cxx:390
librevenge
Definition: MWAWDocument.hxx:57
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:192
MWAWColor::black
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:245
MWAWColor::white
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:250
MWAWColor::isBlack
bool isBlack() const
return true if the color is black
Definition: libmwaw_internal.hxx:284
MWAWFont::Line
a small struct to define a line in MWAWFont
Definition: MWAWFont.hxx:47
MWAWFont::Line::Style
Style
the line style
Definition: MWAWFont.hxx:49
MWAWFont::Line::None
@ None
Definition: MWAWFont.hxx:49
MWAWFont::Line::Dot
@ Dot
Definition: MWAWFont.hxx:49
MWAWFont::Line::Dash
@ Dash
Definition: MWAWFont.hxx:49
MWAWFont::Line::LargeDot
@ LargeDot
Definition: MWAWFont.hxx:49
MWAWFont::Line::Simple
@ Simple
Definition: MWAWFont.hxx:49
MWAWFont::Line::Wave
@ Wave
Definition: MWAWFont.hxx:49
MWAWFont::Line::isSet
bool isSet() const
return true if the line is not empty
Definition: MWAWFont.hxx:62
MWAWFont::Line::m_type
Type m_type
the type
Definition: MWAWFont.hxx:97
MWAWFont::Line::operator<<
friend std::ostream & operator<<(std::ostream &o, Line const &line)
operator<<
Definition: MWAWFont.cxx:49
MWAWFont::Line::Line
Line(Style style=None, Type type=Single, bool wordFlag=false, float w=1.0)
constructor
Definition: MWAWFont.hxx:53
MWAWFont::Line::m_width
float m_width
the width in point
Definition: MWAWFont.hxx:99
MWAWFont::Line::operator!=
bool operator!=(Line const &oth) const
operator!=
Definition: MWAWFont.hxx:76
MWAWFont::Line::Type
Type
the line style
Definition: MWAWFont.hxx:51
MWAWFont::Line::Single
@ Single
Definition: MWAWFont.hxx:51
MWAWFont::Line::Double
@ Double
Definition: MWAWFont.hxx:51
MWAWFont::Line::Triple
@ Triple
Definition: MWAWFont.hxx:51
MWAWFont::Line::m_color
MWAWVariable< MWAWColor > m_color
the color ( if not set, we use the font color )
Definition: MWAWFont.hxx:101
MWAWFont::Line::m_style
Style m_style
the style
Definition: MWAWFont.hxx:95
MWAWFont::Line::operator==
bool operator==(Line const &oth) const
operator==
Definition: MWAWFont.hxx:71
MWAWFont::Line::cmp
int cmp(Line const &oth) const
small comparison function
Definition: MWAWFont.hxx:81
MWAWFont::Line::m_word
bool m_word
word or not word line
Definition: MWAWFont.hxx:103
MWAWFont::Line::addTo
void addTo(librevenge::RVNGPropertyList &propList, std::string const &type) const
add a line to the propList knowing the type (line-through, underline, overline )
Definition: MWAWFont.cxx:96
MWAWFont::Script
a small struct to define the script position in MWAWFont
Definition: MWAWFont.hxx:106
MWAWFont::Script::operator==
bool operator==(Script const &oth) const
operator==
Definition: MWAWFont.hxx:143
MWAWFont::Script::Script
Script(float delta=0, librevenge::RVNGUnit deltaUnit=librevenge::RVNG_PERCENT, int scale=100)
constructor
Definition: MWAWFont.hxx:108
MWAWFont::Script::m_deltaUnit
librevenge::RVNGUnit m_deltaUnit
the ydelta unit ( point or percent )
Definition: MWAWFont.hxx:184
MWAWFont::Script::sub100
static Script sub100()
return a yposition which correspond to a basic subscript100
Definition: MWAWFont.hxx:125
MWAWFont::Script::isSet
bool isSet() const
return true if the position is not default
Definition: MWAWFont.hxx:115
MWAWFont::Script::operator<=
bool operator<=(Script const &oth) const
operator<=
Definition: MWAWFont.hxx:158
MWAWFont::Script::cmp
int cmp(Script const &oth) const
small comparison function
Definition: MWAWFont.hxx:173
MWAWFont::Script::str
std::string str(float fSize) const
return a string which correspond to style:text-position
Definition: MWAWFont.cxx:148
MWAWFont::Script::operator>=
bool operator>=(Script const &oth) const
operator>=
Definition: MWAWFont.hxx:168
MWAWFont::Script::m_scale
int m_scale
the font scaling ( in percent )
Definition: MWAWFont.hxx:186
MWAWFont::Script::super100
static Script super100()
return a yposition which correspond to a basic superscript100
Definition: MWAWFont.hxx:135
MWAWFont::Script::operator<
bool operator<(Script const &oth) const
operator<
Definition: MWAWFont.hxx:153
MWAWFont::Script::sub
static Script sub()
return a yposition which correspond to a basic subscript
Definition: MWAWFont.hxx:120
MWAWFont::Script::m_delta
float m_delta
the ydelta
Definition: MWAWFont.hxx:182
MWAWFont::Script::operator>
bool operator>(Script const &oth) const
operator>
Definition: MWAWFont.hxx:163
MWAWFont::Script::super
static Script super()
return a yposition which correspond to a basic superscript
Definition: MWAWFont.hxx:130
MWAWFont::Script::operator!=
bool operator!=(Script const &oth) const
operator!=
Definition: MWAWFont.hxx:148
MWAWVariable< MWAWColor >
MWAWVariable::insert
void insert(MWAWVariable const &orig)
update the current value if orig is set
Definition: libmwaw_internal.hxx:600
MWAWVariable::isSet
bool isSet() const
return true if the variable is set
Definition: libmwaw_internal.hxx:635
MWAWVariable::get
T const & get() const
return the current value
Definition: libmwaw_internal.hxx:630