mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
'margin' property support
This commit is contained in:
parent
81e2abe85d
commit
fce3eda3a7
2 changed files with 39 additions and 3 deletions
|
@ -243,6 +243,37 @@ shared_ptr<ZLTextStyleEntry> StyleSheetTable::createOrUpdateControl(const Attrib
|
|||
}
|
||||
}
|
||||
|
||||
StyleSheetTable::AttributeMap::const_iterator it = styles.find("margin");
|
||||
if (it != styles.end()) {
|
||||
std::vector<std::string> split = ZLStringUtil::split(it->second, " ", true);
|
||||
if (split.size() > 0) {
|
||||
switch (split.size()) {
|
||||
case 1:
|
||||
split.push_back(split[0]);
|
||||
// go through
|
||||
case 2:
|
||||
split.push_back(split[0]);
|
||||
// go through
|
||||
case 3:
|
||||
split.push_back(split[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
short size;
|
||||
ZLTextStyleEntry::SizeUnit unit;
|
||||
if (parseLength(split[0], size, unit)) {
|
||||
entry->setLength(ZLTextStyleEntry::LENGTH_SPACE_BEFORE, size, unit);
|
||||
}
|
||||
if (parseLength(split[1], size, unit)) {
|
||||
entry->setLength(ZLTextStyleEntry::LENGTH_RIGHT_INDENT, size, unit);
|
||||
}
|
||||
if (parseLength(split[2], size, unit)) {
|
||||
entry->setLength(ZLTextStyleEntry::LENGTH_SPACE_AFTER, size, unit);
|
||||
}
|
||||
if (parseLength(split[3], size, unit)) {
|
||||
entry->setLength(ZLTextStyleEntry::LENGTH_LEFT_INDENT, size, unit);
|
||||
}
|
||||
}
|
||||
setLength(*entry, ZLTextStyleEntry::LENGTH_LEFT_INDENT, styles, "margin-left");
|
||||
setLength(*entry, ZLTextStyleEntry::LENGTH_RIGHT_INDENT, styles, "margin-right");
|
||||
setLength(*entry, ZLTextStyleEntry::LENGTH_FIRST_LINE_INDENT, styles, "text-indent");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue