~ubuntu-branches/ubuntu/dapper/poppler/dapper-security

« back to all changes in this revision

Viewing changes to utils/HtmlFonts.h

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2005-12-30 11:34:07 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051230113407-8grizsk0ar874uoi
Tags: 0.4.3-1
* New upstream release.
* New maintainer (Closes: #344738)
* CVE-2005-3191 and CAN-2005-2097 fixes merged upstream.
* Fixed some rendering bugs and disabled Cairo output
  (Closes: #314556, #322964, #328211)
* Acknowledge NMU (Closes: #342288)
* Add 001-selection-crash-bug.patch (Closes: #330544)
* Add poppler-utils (merge patch from Ubuntu)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef _HTML_FONTS_H
2
 
#define _HTML_FONTS_H
3
 
#include "GVector.h"
4
 
#include "goo/GooString.h"
5
 
#include "GfxState.h"
6
 
#include "CharTypes.h"
7
 
 
8
 
 
9
 
class HtmlFontColor{
10
 
 private:
11
 
   unsigned int r;
12
 
   unsigned int g;
13
 
   unsigned int b;
14
 
   GBool Ok(unsigned int xcol){ return ((xcol<=255)&&(xcol>=0));}
15
 
   GooString *convtoX(unsigned  int xcol) const;
16
 
 public:
17
 
   HtmlFontColor():r(0),g(0),b(0){}
18
 
   HtmlFontColor(GfxRGB rgb);
19
 
   HtmlFontColor(const HtmlFontColor& x){r=x.r;g=x.g;b=x.b;}
20
 
   HtmlFontColor& operator=(const HtmlFontColor &x){
21
 
     r=x.r;g=x.g;b=x.b;
22
 
     return *this;
23
 
   }
24
 
   ~HtmlFontColor(){};
25
 
   GooString* toString() const;
26
 
   GBool isEqual(const HtmlFontColor& col) const{
27
 
     return ((r==col.r)&&(g==col.g)&&(b==col.b));
28
 
   }
29
 
} ;  
30
 
 
31
 
 
32
 
class HtmlFont{
33
 
 private:
34
 
   unsigned int size;
35
 
   int lineSize;
36
 
   GBool italic;
37
 
   GBool bold;
38
 
   int pos; // position of the font name in the fonts array
39
 
   static GooString *DefaultFont;
40
 
   GooString *FontName;
41
 
   HtmlFontColor color;
42
 
   static GooString* HtmlFilter(Unicode* u, int uLen); //char* s);
43
 
public:  
44
 
 
45
 
   HtmlFont(){FontName=NULL;};
46
 
   HtmlFont(GooString* fontname,int _size, GfxRGB rgb);
47
 
   HtmlFont(const HtmlFont& x);
48
 
   HtmlFont& operator=(const HtmlFont& x);
49
 
   HtmlFontColor getColor() const {return color;}
50
 
   ~HtmlFont();
51
 
   static void clear();
52
 
   GooString* getFullName();
53
 
   GBool isItalic() const {return italic;}
54
 
   GBool isBold() const {return bold;}
55
 
   unsigned int getSize() const {return size;}
56
 
   int getLineSize() const {return lineSize;}
57
 
   void setLineSize(int _lineSize) { lineSize = _lineSize; }
58
 
   GooString* getFontName();
59
 
   static GooString* getDefaultFont();
60
 
   static void setDefaultFont(GooString* defaultFont);
61
 
   GBool isEqual(const HtmlFont& x) const;
62
 
   GBool isEqualIgnoreBold(const HtmlFont& x) const;
63
 
   static GooString* simple(HtmlFont *font, Unicode *content, int uLen);
64
 
   void print() const {printf("font: %s %d %s%spos: %d\n", FontName->getCString(), size, bold ? "bold " : "", italic ? "italic " : "", pos);};
65
 
};
66
 
 
67
 
class HtmlFontAccu{
68
 
private:
69
 
  GVector<HtmlFont> *accu;
70
 
  
71
 
public:
72
 
  HtmlFontAccu();
73
 
  ~HtmlFontAccu();
74
 
  int AddFont(const HtmlFont& font);
75
 
  HtmlFont* Get(int i){
76
 
    GVector<HtmlFont>::iterator g=accu->begin();
77
 
    g+=i;  
78
 
    return g;
79
 
  } 
80
 
  GooString* getCSStyle (int i, GooString* content);
81
 
  GooString* CSStyle(int i);
82
 
  int size() const {return accu->size();}
83
 
  
84
 
};  
85
 
#endif