added support for extraction of font boolean atrributes like bold and…#23
added support for extraction of font boolean atrributes like bold and…#23aloknayak29 wants to merge 1 commit intoizderadicka:masterfrom
Conversation
… italic (surely True positive but can be false negative)
| unicode name | ||
| double size | ||
| Color color | ||
| PyBool isbold |
There was a problem hiding this comment.
I think this could be rather bool type, to delay type coercion to Python boolean until it's really required.
| def __cinit__(self, unicode name, double size, Color color, PyBool isbold, PyBool isitalic): | ||
| #nparts=name.split('+',1) | ||
| #self.name=nparts[-1] | ||
| self.name=name |
There was a problem hiding this comment.
Changing the content of name could break existing implementations, I guess if full name is needed it should be new property full_name
| def __cinit__(self, unicode name, double size, Color color): | ||
| nparts=name.split('+',1) | ||
| self.name=nparts[-1] | ||
| def __cinit__(self, unicode name, double size, Color color, PyBool isbold, PyBool isitalic): |
There was a problem hiding this comment.
use Python naming convetion - snake case - e.g. is_bold is_italic
| self.color=color | ||
| self.isbold=isbold | ||
| self.isitalic=isitalic | ||
|
|
| return self.isitalic | ||
| def __set__(self, PyBool val): | ||
| self.isitalic=val | ||
|
|
| self._bboxes.append(last_bbox) | ||
| w.getColor(&r, &g, &b) | ||
| font_name=w.getFontName(i) | ||
| textfontinfo = w.getFontInfo(i) |
There was a problem hiding this comment.
definitelly need to handle case when w.getFontInfo returns null
|
Thanks for PR - see detail comments in code for particular issues. |
|
Could you also elaborate bit on false negatives? When it happens? I actually use font name to check for bold ( in python) |
|
Thanks for the code reviews. I will update my repo soon. |
Added support for extraction of font boolean atrributes like bold and italic (from textfontinfo class). Note that experiments revealed that these attributes will surely be True positive but can be false negative.