~ubuntu-branches/ubuntu/saucy/emscripten/saucy-proposed

« back to all changes in this revision

Viewing changes to tests/poppler/utils/HtmlFonts.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//========================================================================
 
2
//
 
3
// This file comes from pdftohtml project
 
4
// http://pdftohtml.sourceforge.net
 
5
//
 
6
// Copyright from:
 
7
// Gueorgui Ovtcharov
 
8
// Rainer Dorsch <http://www.ra.informatik.uni-stuttgart.de/~rainer/>
 
9
// Mikhail Kruk <meshko@cs.brandeis.edu>
 
10
//
 
11
//========================================================================
 
12
 
 
13
//========================================================================
 
14
//
 
15
// Modified under the Poppler project - http://poppler.freedesktop.org
 
16
//
 
17
// All changes made under the Poppler project to this file are licensed
 
18
// under GPL version 2 or later
 
19
//
 
20
// Copyright (C) 2010 OSSD CDAC Mumbai by Leena Chourey (leenac@cdacmumbai.in) and Onkar Potdar (onkar@cdacmumbai.in)
 
21
// Copyright (C) 2010 Albert Astals Cid <aacid@kde.org>
 
22
//
 
23
// To see a description of the changes please see the Changelog file that
 
24
// came with your tarball or type make ChangeLog if you are building from git
 
25
//
 
26
//========================================================================
 
27
 
 
28
#ifndef _HTML_FONTS_H
 
29
#define _HTML_FONTS_H
 
30
#include "goo/GooString.h"
 
31
#include "GfxState.h"
 
32
#include "CharTypes.h"
 
33
#include <vector>
 
34
 
 
35
class HtmlFontColor{
 
36
 private:
 
37
   unsigned int r;
 
38
   unsigned int g;
 
39
   unsigned int b;
 
40
   GBool Ok(unsigned int xcol){ return ((xcol<=255)&&(xcol>=0));}
 
41
   GooString *convtoX(unsigned  int xcol) const;
 
42
 public:
 
43
   HtmlFontColor():r(0),g(0),b(0){}
 
44
   HtmlFontColor(GfxRGB rgb);
 
45
   HtmlFontColor(const HtmlFontColor& x){r=x.r;g=x.g;b=x.b;}
 
46
   HtmlFontColor& operator=(const HtmlFontColor &x){
 
47
     r=x.r;g=x.g;b=x.b;
 
48
     return *this;
 
49
   }
 
50
   ~HtmlFontColor(){};
 
51
   GooString* toString() const;
 
52
   GBool isEqual(const HtmlFontColor& col) const{
 
53
     return ((r==col.r)&&(g==col.g)&&(b==col.b));
 
54
   }
 
55
} ;  
 
56
 
 
57
 
 
58
class HtmlFont{
 
59
 private:
 
60
   unsigned int size;
 
61
   int lineSize;
 
62
   GBool italic;
 
63
   GBool bold;
 
64
   int pos; // position of the font name in the fonts array
 
65
   static GooString *DefaultFont;
 
66
   GooString *FontName;
 
67
   HtmlFontColor color;
 
68
   static GooString* HtmlFilter(Unicode* u, int uLen); //char* s);
 
69
public:  
 
70
 
 
71
   HtmlFont(){FontName=NULL;};
 
72
   HtmlFont(GooString* fontname,int _size, GfxRGB rgb);
 
73
   HtmlFont(const HtmlFont& x);
 
74
   HtmlFont& operator=(const HtmlFont& x);
 
75
   HtmlFontColor getColor() const {return color;}
 
76
   ~HtmlFont();
 
77
   static void clear();
 
78
   GooString* getFullName();
 
79
   GBool isItalic() const {return italic;}
 
80
   GBool isBold() const {return bold;}
 
81
   unsigned int getSize() const {return size;}
 
82
   int getLineSize() const {return lineSize;}
 
83
   void setLineSize(int _lineSize) { lineSize = _lineSize; }
 
84
   GooString* getFontName();
 
85
   static GooString* getDefaultFont();
 
86
   static void setDefaultFont(GooString* defaultFont);
 
87
   GBool isEqual(const HtmlFont& x) const;
 
88
   GBool isEqualIgnoreBold(const HtmlFont& x) const;
 
89
   static GooString* simple(HtmlFont *font, Unicode *content, int uLen);
 
90
   void print() const {printf("font: %s %d %s%spos: %d\n", FontName->getCString(), size, bold ? "bold " : "", italic ? "italic " : "", pos);};
 
91
};
 
92
 
 
93
class HtmlFontAccu{
 
94
private:
 
95
  std::vector<HtmlFont> *accu;
 
96
  
 
97
public:
 
98
  HtmlFontAccu();
 
99
  ~HtmlFontAccu();
 
100
  int AddFont(const HtmlFont& font);
 
101
  HtmlFont *Get(int i){
 
102
    return &(*accu)[i];
 
103
  } 
 
104
  GooString* getCSStyle (int i,GooString* content, int j = 0);
 
105
  GooString* CSStyle(int i, int j = 0);
 
106
  int size() const {return accu->size();}
 
107
  
 
108
};  
 
109
#endif