1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-10-05 19:41:40 +00:00
pdf2htmlEX/src/HTMLState.h

60 lines
1.1 KiB
C
Raw Normal View History

/*
* Header file for HTMLState
* Copyright (C) 2013 Lu Wang <coolwanglu@gmail.com>
*/
#ifndef HTMLSTATE_H__
#define HTMLSTATE_H__
2013-04-06 08:45:01 +00:00
#include "Color.h"
namespace pdf2htmlEX {
struct FontInfo
{
long long id;
bool use_tounicode;
int em_size;
double space_width;
double ascent, descent;
bool is_type3;
2013-05-02 17:47:55 +00:00
bool is_embeded;
};
struct HTMLTextState
{
const FontInfo * font_info;
double font_size;
Color fill_color;
Color stroke_color;
double letter_space;
double word_space;
// relative to the previous state
double vertical_align;
2013-04-06 09:10:18 +00:00
// the offset cause by a single ' ' char
double single_space_offset(void) const {
2013-07-01 02:19:30 +00:00
assert(font_info->em_size != 0);
return word_space + letter_space + font_info->space_width / font_info->em_size * font_size;
2013-04-06 09:10:18 +00:00
}
// calculate em_size of this state
double em_size(void) const {
return font_size * (font_info->ascent - font_info->descent);
}
};
struct HTMLLineState
{
double x,y;
double transform_matrix[4];
};
struct HTMLClipState
{
double xmin, xmax, ymin, ymax;
};
} // namespace pdf2htmlEX
#endif //HTMLSTATE_H__