]> git.lyx.org Git - features.git/blob - src/lyxfont.h
fix the resize bug, make some more inset funcs const, cleanup in lyxscreen, painter...
[features.git] / src / lyxfont.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *       
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.   
9  *
10  * ====================================================== */
11
12 #ifndef LYXFONT_H
13 #define LYXFONT_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include FORMS_H_LOCATION
20 #include "LString.h"
21 #include "debug.h"
22 #include "direction.h"
23 #include "LColor.h"
24
25 // It might happen that locale.h defines ON and OFF. This is not good
26 // for us, since we use these names below. But of course this is due
27 // to some old compilers. Than is broken when it comes to C++ scoping.
28 #include "gettext.h" // so that we are sure tht it won't be included
29 // later. 
30 #ifdef ON
31 #undef ON
32 #endif
33
34 #ifdef OFF
35 #undef OFF
36 #endif
37
38 class LyXLex;
39
40 #define NEW_BITS 1
41
42 ///
43 class LyXFont {
44 public:
45         /** The value INHERIT_* means that the font attribute is
46             inherited from the layout. In the case of layout fonts, the
47             attribute is inherited from the default font.
48             The value IGNORE_* is used with LyXFont::update() when the
49             attribute should not be changed.
50         */
51         enum FONT_FAMILY {
52                 ///
53                 ROMAN_FAMILY, // fontstruct rely on this to be 0
54                 ///
55                 SANS_FAMILY,
56                 ///
57                 TYPEWRITER_FAMILY,
58                 ///
59                 SYMBOL_FAMILY,
60                 ///
61                 INHERIT_FAMILY,
62                 ///
63                 IGNORE_FAMILY
64         };
65
66         ///
67         enum FONT_SERIES {
68                 ///
69                 MEDIUM_SERIES, // fontstruct rely on this to be 0
70                 ///
71                 BOLD_SERIES,
72                 ///
73                 INHERIT_SERIES,
74                 ///
75                 IGNORE_SERIES
76         };
77
78         ///
79         enum FONT_SHAPE {
80                 ///
81                 UP_SHAPE, // fontstruct rely on this to be 0
82                 ///
83                 ITALIC_SHAPE,
84                 ///
85                 SLANTED_SHAPE,
86                 ///
87                 SMALLCAPS_SHAPE,
88                 ///
89                 INHERIT_SHAPE,
90                 ///
91                 IGNORE_SHAPE
92         };
93
94         ///
95         enum FONT_SIZE {
96                 ///
97                 SIZE_TINY, // fontstruct rely on this to be 0
98                 ///
99                 SIZE_SCRIPT,
100                 ///
101                 SIZE_FOOTNOTE,
102                 ///
103                 SIZE_SMALL,
104                 ///
105                 SIZE_NORMAL,
106                 ///
107                 SIZE_LARGE,
108                 ///
109                 SIZE_LARGER,
110                 ///
111                 SIZE_LARGEST,
112                 ///
113                 SIZE_HUGE,
114                 ///
115                 SIZE_HUGER,
116                 ///
117                 INCREASE_SIZE,
118                 ///
119                 DECREASE_SIZE,
120                 ///
121                 INHERIT_SIZE,
122                 ///
123                 IGNORE_SIZE
124         };
125  
126         enum FONT_DIRECTION {
127                 ///
128                 LTR_DIR,
129                 ///
130                 RTL_DIR,
131                 ///
132                 TOGGLE_DIR,
133                 ///
134                 INHERIT_DIR,
135                 ///
136                 IGNORE_DIR
137         };
138
139         /// Used for emph, underbar, noun and latex toggles
140         enum FONT_MISC_STATE {
141                 ///
142                 OFF,
143                 ///
144                 ON,
145                 ///
146                 TOGGLE,
147                 ///
148                 INHERIT,
149                 ///
150                 IGNORE
151         };
152
153         /// Trick to overload constructor and make it megafast
154         enum FONT_INIT1 {
155                 ///
156                 ALL_INHERIT
157         };
158         ///
159         enum FONT_INIT2 {
160                 ///
161                 ALL_IGNORE
162         };
163         ///
164         enum FONT_INIT3 {
165                 ///
166                 ALL_SANE
167         };
168
169         ///
170         LyXFont();
171
172         /// LyXFont x(LyXFont ...) and LyXFont x = LyXFont ...
173         LyXFont(LyXFont const & x);
174  
175         /// Shortcut initialization
176         LyXFont(LyXFont::FONT_INIT1);
177         /// Shortcut initialization
178         LyXFont(LyXFont::FONT_INIT2);
179         /// Shortcut initialization
180         LyXFont(LyXFont::FONT_INIT3);
181
182         /// LyXFont x, y; x = y;
183         LyXFont & operator=(LyXFont const & x);
184  
185         /// Decreases font size by one
186         LyXFont & decSize();
187  
188         /// Increases font size by one
189         LyXFont & incSize();
190  
191         ///
192         FONT_FAMILY family() const;
193  
194         ///
195         FONT_SERIES series() const;
196  
197         ///
198         FONT_SHAPE shape() const;
199  
200         ///
201         FONT_SIZE size() const;
202  
203         ///
204         FONT_MISC_STATE emph() const;
205  
206         ///
207         FONT_MISC_STATE underbar() const;
208  
209         ///
210         FONT_MISC_STATE noun() const;
211
212         ///
213         FONT_MISC_STATE latex() const;
214
215         ///
216         LColor::color color() const;
217
218         ///
219         FONT_DIRECTION direction() const;
220
221         ///
222         LyXDirection getFontDirection() const;
223         
224         ///
225         LyXFont & setFamily(LyXFont::FONT_FAMILY f);
226         ///
227         LyXFont & setSeries(LyXFont::FONT_SERIES s);
228         ///
229         LyXFont & setShape(LyXFont::FONT_SHAPE s);
230         ///
231         LyXFont & setSize(LyXFont::FONT_SIZE s);
232         ///
233         LyXFont & setEmph(LyXFont::FONT_MISC_STATE e);
234         ///
235         LyXFont & setUnderbar(LyXFont::FONT_MISC_STATE u);
236         ///
237         LyXFont & setNoun(LyXFont::FONT_MISC_STATE n);
238         ///
239         LyXFont & setLatex(LyXFont::FONT_MISC_STATE l);
240         ///
241         LyXFont & setColor(LColor::color c);
242         ///
243         LyXFont & setDirection(LyXFont::FONT_DIRECTION d);
244
245         /// Set family after LyX text format
246         LyXFont & setLyXFamily(string const &);
247  
248         /// Set series after LyX text format
249         LyXFont & setLyXSeries(string const &);
250  
251         /// Set shape after LyX text format
252         LyXFont & setLyXShape(string const &);
253  
254         /// Set size after LyX text format
255         LyXFont & setLyXSize(string const &);
256  
257         /// Returns misc flag after LyX text format
258         LyXFont::FONT_MISC_STATE setLyXMisc(string const &);
259
260         /// Sets color after LyX text format
261         LyXFont & setLyXColor(string const &);
262  
263         /// Sets size after GUI name
264         LyXFont & setGUISize(string const &);
265  
266         /// Returns size of font in LaTeX text notation
267         string latexSize() const;
268  
269         /** Updates font settings according to request. If an
270             attribute is IGNORE, the attribute is left as it is. */
271         /* 
272          * When toggleall = true, all properties that matches the font in use
273          * will have the effect that the properties is reset to the
274          * default.  If we have a text that is TYPEWRITER_FAMILY, and is
275          * update()'ed with TYPEWRITER_FAMILY, the operation will be as if
276          * a INHERIT_FAMILY was asked for.  This is necessary for the
277          * toggle-user-defined-style button on the toolbar.
278          */
279         void update(LyXFont const & newfont, bool toggleall = false);
280  
281         /** Reduce font to fall back to template where possible.
282             Equal fields are reduced to INHERIT */
283         void reduce(LyXFont const & tmplt);
284  
285         /// Realize font from a template (INHERIT are realized)
286         LyXFont & realize(LyXFont const & tmplt);
287
288         /// Is a given font fully resolved?
289         bool resolved() const;
290  
291         /// Read a font specification from LyXLex. Used for layout files.
292         LyXFont & lyxRead(LyXLex &);
293  
294         /// Writes the changes from this font to orgfont in .lyx format in file
295         void lyxWriteChanges(LyXFont const & orgfont, ostream &) const;
296
297         /** Writes the head of the LaTeX needed to change to this font.
298             Writes to string, the head of the LaTeX needed to change
299             to this font. Returns number of chars written. Base is the
300             font state active now.
301         */
302         int latexWriteStartChanges(string &, LyXFont const & base,
303                                    LyXFont const & prev) const;
304
305         /** Writes tha tail of the LaTeX needed to chagne to this font.
306             Returns number of chars written. Base is the font state we want
307             to achieve.
308         */
309         int latexWriteEndChanges(string &, LyXFont const & base,
310                                  LyXFont const & next) const;
311  
312         /// Build GUI description of font state
313         string stateText() const;
314
315         ///
316         int maxAscent() const; 
317
318         ///
319         int maxDescent() const;
320
321         ///
322         int ascent(char c) const;
323
324         ///
325         int descent(char c) const;
326
327         ///
328         int width(char c) const;
329
330         ///
331         int lbearing(char c) const;
332
333         ///
334         int rbearing(char c) const;
335         
336         ///
337         int textWidth(char const *s, int n) const;
338
339         ///
340         int stringWidth(string const & s) const;
341
342         ///
343         int signedStringWidth(string const & s) const;
344
345         /// Draws text and returns width of text
346         int drawText(char const *, int n, Pixmap, int baseline, int x) const;
347
348         ///
349         int drawString(string const &, Pixmap pm, int baseline, int x) const;
350
351         ///
352         LColor::color realColor() const;
353
354         ///
355         XID getFontID() const {
356                 return getXFontstruct()->fid;
357         }
358         
359         ///
360         friend inline
361         bool operator==(LyXFont const & font1, LyXFont const & font2) {
362                 return font1.bits == font2.bits;
363         }
364
365         ///
366         friend inline
367         bool operator!=(LyXFont const & font1, LyXFont const & font2) {
368                 return font1.bits != font2.bits;
369         }
370
371         /// compares two fonts, ignoring the setting of the Latex part.
372         bool equalExceptLatex(LyXFont const &) const;
373
374 private:
375 #ifdef NEW_BITS
376         ///
377         struct FontBits {
378                 bool operator==(FontBits const & fb1) const {
379                         return fb1.family == family &&
380                                 fb1.series == series &&
381                                 fb1.shape == shape &&
382                                 fb1.size == size &&
383                                 fb1.color == color &&
384                                 fb1.emph == emph &&
385                                 fb1.underbar == underbar &&
386                                 fb1.noun == noun &&
387                                 fb1.latex == latex &&
388                                 fb1.direction == direction;
389                 }
390                 bool operator!=(FontBits const & fb1) const {
391                         return !(fb1 == *this);
392                 }
393                 
394                 FONT_FAMILY family;
395                 FONT_SERIES series;
396                 FONT_SHAPE shape;
397                 FONT_SIZE size;
398                 LColor::color color;
399                 FONT_MISC_STATE emph;
400                 FONT_MISC_STATE underbar;
401                 FONT_MISC_STATE noun;
402                 FONT_MISC_STATE latex;
403                 FONT_DIRECTION direction;
404         };
405 #else
406         /// This have to be at least 32 bits, but 64 or more does not hurt
407         typedef unsigned int ui32;
408 #endif
409
410         /** Representation: bit table
411             Layout of bit table:
412                 11 1111 111 122 222 222 2233
413             Bit 012 34 567 8901 2345 678 901 234 567 8901
414                 FFF SS SSS SSSS CCCC EEE UUU NNN LLL
415                 aaa ee hhh iiii oooo mmm nnn ooo aaa
416                 mmm rr aaa zzzz llll ppp ddd uuu ttt
417
418             Bit 76543210 76543210 76543210 76543210
419                                                 --- Fam_Pos
420                                               --    Ser_Pos
421                                            ---      Sha_Pos
422                                       ----          Siz_Pos
423                                   ----              Col_Pos
424                               ---                   Emp_Pos
425                            ---                      Und_Pos
426                        - --                         Nou_Pos
427                     ---                             Lat_Pos
428                 ----                                Dir_Pos
429                 
430             Some might think this is a dirty representation, but it gives
431             us at least 25% speed-up, so why not? (Asger)
432
433             First of all it is a maintence nightmare...and now that we need
434             to enlarge the Color bits with 2 (from 4 to 6), we have a problem
435             since a 32 bit entity is not large enough... (Lgb)
436         */
437
438 #ifdef NEW_BITS
439         FontBits bits;
440 #else
441         ui32 bits;
442         
443         ///
444         enum FONT_POSITION {
445                 ///
446                 Fam_Pos =  0,
447                 ///
448                 Ser_Pos =  3,
449                 ///
450                 Sha_Pos =  5,
451                 ///
452                 Siz_Pos =  8,
453                 ///
454                 Col_Pos = 12,
455                 ///
456                 Emp_Pos = 16,
457                 ///
458                 Und_Pos = 19,
459                 ///
460                 Nou_Pos = 22,
461                 ///
462                 Lat_Pos = 25,
463                 ///
464                 Dir_Pos = 28
465         };
466
467         ///
468         enum FONT_MASK {
469                 ///
470                 Fam_Mask = 0x07,
471                 ///
472                 Ser_Mask = 0x03,
473                 ///
474                 Sha_Mask = 0x07,
475                 ///
476                 Siz_Mask = 0x0f,
477                 ///
478                 Col_Mask = 0x0f,
479                 ///
480                 Dir_Mask = 0x07,
481                 ///
482                 Misc_Mask = 0x07
483         };
484 #endif
485
486         
487 #ifdef NEW_BITS
488         /// Sane font
489         static FontBits sane;
490         
491         /// All inherit font
492         static FontBits inherit;
493  
494         /// All ignore font
495         static FontBits ignore;
496
497 #else
498         /// Sane font
499         enum {  sane = ui32(ROMAN_FAMILY) << Fam_Pos
500                 | ui32(MEDIUM_SERIES) << Ser_Pos
501                 | ui32(UP_SHAPE) << Sha_Pos
502                 | ui32(SIZE_NORMAL) << Siz_Pos
503                 | ui32(LColor::none) << Col_Pos
504                 | ui32(OFF) << Emp_Pos
505                 | ui32(OFF) << Und_Pos
506                 | ui32(OFF) << Nou_Pos
507                 | ui32(OFF) << Lat_Pos
508                 | ui32(LTR_DIR) << Dir_Pos};
509         
510         /// All inherit font
511         enum{ inherit = ui32(INHERIT_FAMILY) << Fam_Pos
512                       | ui32(INHERIT_SERIES) << Ser_Pos
513                       | ui32(INHERIT_SHAPE) << Sha_Pos
514                       | ui32(INHERIT_SIZE) << Siz_Pos
515                       | ui32(LColor::inherit) << Col_Pos
516                       | ui32(INHERIT) << Emp_Pos
517                       | ui32(INHERIT) << Und_Pos
518                       | ui32(INHERIT) << Nou_Pos
519                       | ui32(INHERIT) << Lat_Pos
520                       | ui32(INHERIT_DIR) << Dir_Pos};
521  
522         /// All ignore font
523         enum{ ignore = ui32(IGNORE_FAMILY) << Fam_Pos
524                       | ui32(IGNORE_SERIES) << Ser_Pos
525                       | ui32(IGNORE_SHAPE) << Sha_Pos
526                       | ui32(IGNORE_SIZE) << Siz_Pos
527                       | ui32(LColor::ignore) << Col_Pos
528                       | ui32(IGNORE) << Emp_Pos
529                       | ui32(IGNORE) << Und_Pos
530                       | ui32(IGNORE) << Nou_Pos
531                       | ui32(IGNORE) << Lat_Pos
532                       | ui32(IGNORE_DIR) << Dir_Pos};
533 #endif
534         /// Updates a misc setting according to request
535         LyXFont::FONT_MISC_STATE setMisc(LyXFont::FONT_MISC_STATE newfont,
536                                          LyXFont::FONT_MISC_STATE org);
537
538         /// Converts logical attributes to concrete shape attribute
539         LyXFont::FONT_SHAPE realShape() const;
540
541         ///
542         XFontStruct * getXFontstruct() const;
543 };
544
545 ostream & operator<<(ostream &, LyXFont::FONT_MISC_STATE);
546
547 inline LyXFont::LyXFont()
548 {
549         bits = sane;
550 }
551
552
553 inline LyXFont::LyXFont(LyXFont const & x)
554 {
555         bits = x.bits;
556 }
557
558
559 inline LyXFont::LyXFont(LyXFont::FONT_INIT1)
560 {
561         bits = inherit;
562 }
563
564
565 inline LyXFont::LyXFont(LyXFont::FONT_INIT2)
566 {
567         bits = ignore;
568 }
569
570
571 inline LyXFont::LyXFont(LyXFont::FONT_INIT3)
572 {
573         bits = sane;
574 }
575
576
577 inline LyXFont & LyXFont::operator=(LyXFont const & x) 
578 {
579         bits = x.bits;
580         return *this;
581 }
582
583
584 #ifdef NEW_BITS
585 // You don't have to understand the stuff below :-)
586 // It works, and it's bloody fast. (Asger)
587 // And impossible to work with. (Lgb)
588
589 inline
590 LyXFont::FONT_FAMILY LyXFont::family() const 
591 {
592         return bits.family;
593 }
594
595
596 inline
597 LyXFont::FONT_SERIES LyXFont::series() const
598 {
599         return bits.series;
600 }
601
602
603 inline
604 LyXFont::FONT_SHAPE LyXFont::shape() const
605 {
606         return bits.shape;
607 }
608
609
610 inline
611 LyXFont::FONT_SIZE LyXFont::size() const
612 {
613         return bits.size;
614 }
615
616
617 inline
618 LyXFont::FONT_MISC_STATE LyXFont::emph() const
619 {
620         return bits.emph;
621 }
622
623
624 inline
625 LyXFont::FONT_MISC_STATE LyXFont::underbar() const
626 {
627         return bits.underbar;
628 }
629
630
631 inline
632 LyXFont::FONT_MISC_STATE LyXFont::noun() const
633 {
634         return bits.noun;
635 }
636
637
638 inline
639 LyXFont::FONT_MISC_STATE LyXFont::latex() const 
640 {
641         return bits.latex;
642 }
643
644
645 inline
646 LColor::color LyXFont::color() const 
647 {
648         return bits.color;
649 }
650
651
652 inline
653 LyXFont::FONT_DIRECTION LyXFont::direction() const 
654 {
655         return bits.direction;
656 }
657
658 inline
659 LyXFont & LyXFont::setFamily(LyXFont::FONT_FAMILY f)
660 {
661         bits.family = f;
662         return *this;
663 }
664
665
666 inline
667 LyXFont & LyXFont::setSeries(LyXFont::FONT_SERIES s)
668 {
669         bits.series = s;
670         return *this;
671 }
672
673
674 inline
675 LyXFont & LyXFont::setShape(LyXFont::FONT_SHAPE s)
676 {
677         bits.shape = s;
678         return *this;
679 }
680
681
682 inline
683 LyXFont & LyXFont::setSize(LyXFont::FONT_SIZE s)
684 {
685         bits.size = s;
686         return *this;
687 }
688
689
690 inline
691 LyXFont & LyXFont::setEmph(LyXFont::FONT_MISC_STATE e)
692 {
693         bits.emph = e;
694         return *this;
695 }
696
697
698 inline
699 LyXFont & LyXFont::setUnderbar(LyXFont::FONT_MISC_STATE u)
700 {
701         bits.underbar = u;
702         return *this;
703 }
704
705
706 inline
707 LyXFont & LyXFont::setNoun(LyXFont::FONT_MISC_STATE n)
708 {
709         bits.noun = n;
710         return *this;
711 }
712
713 inline
714 LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
715 {
716         bits.latex = l;
717         return *this;
718 }
719
720
721 inline
722 LyXFont & LyXFont::setColor(LColor::color c)
723 {
724         bits.color = c;
725         return *this;
726 }
727
728
729 inline
730 LyXFont & LyXFont::setDirection(LyXFont::FONT_DIRECTION d)
731 {
732         bits.direction = d;
733         return *this;
734 }
735 #else
736 // You don't have to understand the stuff below :-)
737 // It works, and it's bloody fast. (Asger)
738 // And impossible to work with. (Lgb)
739
740 inline LyXFont::FONT_FAMILY LyXFont::family() const 
741 {
742         return LyXFont::FONT_FAMILY((bits >> Fam_Pos) & Fam_Mask);
743 }
744
745
746 inline LyXFont::FONT_SERIES LyXFont::series() const
747 {
748         return LyXFont::FONT_SERIES((bits >> Ser_Pos) & Ser_Mask);
749 }
750
751
752 inline LyXFont::FONT_SHAPE LyXFont::shape() const
753 {
754         return LyXFont::FONT_SHAPE((bits >> Sha_Pos) & Sha_Mask);
755 }
756
757
758 inline LyXFont::FONT_SIZE LyXFont::size() const
759 {
760         return LyXFont::FONT_SIZE((bits >> Siz_Pos) & Siz_Mask);
761 }
762
763
764 inline LyXFont::FONT_MISC_STATE LyXFont::emph() const
765 {
766         return LyXFont::FONT_MISC_STATE((bits >> Emp_Pos) & Misc_Mask);
767 }
768
769
770 inline LyXFont::FONT_MISC_STATE LyXFont::underbar() const
771 {
772         return LyXFont::FONT_MISC_STATE((bits >> Und_Pos) & Misc_Mask);
773 }
774
775
776 inline LyXFont::FONT_MISC_STATE LyXFont::noun() const
777 {
778         return LyXFont::FONT_MISC_STATE((bits >> Nou_Pos) & Misc_Mask);
779 }
780
781
782 inline LyXFont::FONT_MISC_STATE LyXFont::latex() const 
783 {
784         return LyXFont::FONT_MISC_STATE((bits >> Lat_Pos) & Misc_Mask);
785 }
786
787
788 inline LColor::color LyXFont::color() const 
789 {
790         return LColor::color((bits >> Col_Pos) & Col_Mask);
791 }
792
793
794 inline LyXFont::FONT_DIRECTION LyXFont::direction() const 
795 {
796         return LyXFont::FONT_DIRECTION((bits >> Dir_Pos) & Dir_Mask);
797 }
798
799 inline LyXFont & LyXFont::setFamily(LyXFont::FONT_FAMILY f)
800 {
801         bits &= ~(Fam_Mask << Fam_Pos);
802         bits |= ui32(f) << Fam_Pos;
803         return *this;
804 }
805
806
807 inline LyXFont & LyXFont::setSeries(LyXFont::FONT_SERIES s)
808 {
809         bits &= ~(Ser_Mask << Ser_Pos);
810         bits |= ui32(s) << Ser_Pos;
811         return *this;
812 }
813
814
815 inline LyXFont & LyXFont::setShape(LyXFont::FONT_SHAPE s)
816 {
817         bits &= ~(Sha_Mask << Sha_Pos);
818         bits |= ui32(s) << Sha_Pos;
819         return *this;
820 }
821
822
823 inline LyXFont & LyXFont::setSize(LyXFont::FONT_SIZE s)
824 {
825         bits &= ~(Siz_Mask << Siz_Pos);
826         bits |= ui32(s) << Siz_Pos;
827         return *this;
828 }
829
830
831 inline LyXFont & LyXFont::setEmph(LyXFont::FONT_MISC_STATE e)
832 {
833         bits &= ~(Misc_Mask << Emp_Pos);
834         bits |= ui32(e) << Emp_Pos;
835         return *this;
836 }
837
838
839 inline LyXFont & LyXFont::setUnderbar(LyXFont::FONT_MISC_STATE u)
840 {
841         bits &= ~(Misc_Mask << Und_Pos);
842         bits |= ui32(u) << Und_Pos;
843         return *this;
844 }
845
846
847 inline LyXFont & LyXFont::setNoun(LyXFont::FONT_MISC_STATE n)
848 {
849         bits &= ~(Misc_Mask << Nou_Pos);
850         bits |= ui32(n) << Nou_Pos;
851         return *this;
852 }
853
854 inline LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
855 {
856         bits &= ~(Misc_Mask << Lat_Pos);
857         bits |= ui32(l) << Lat_Pos;
858         return *this;
859 }
860
861
862 inline LyXFont & LyXFont::setColor(LColor::color c)
863 {
864         bits &= ~(Col_Mask << Col_Pos);
865         bits |= ui32(c) << Col_Pos;
866         return *this;
867 }
868
869
870 inline LyXFont & LyXFont::setDirection(LyXFont::FONT_DIRECTION d)
871 {
872         bits &= ~(Dir_Mask << Dir_Pos);
873         bits |= ui32(d) << Dir_Pos;
874         return *this;
875 }
876 #endif
877
878 #endif