mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix transform of font keywords
This commit is contained in:
parent
29e2561d61
commit
dd2450e092
@ -263,7 +263,7 @@ class Token {
|
|||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
out.resize(out.size() + num);
|
out.resize(out.size() + num);
|
||||||
for (int i = 0; i < num; i++) out[i + out.size() - num] = buf[i];
|
for (int i = 0; i < num; i++) out[i + out.size() - num] = buf[i];
|
||||||
} else throw std::logic_error("Failed to convert character to hexedecimal escape");
|
} else throw std::logic_error("Failed to convert character to hexadecimal escape");
|
||||||
} else out.push_back(ch);
|
} else out.push_back(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,6 +632,7 @@ class TokenQueue {
|
|||||||
auto fsm = font_size_keywords.find(key);
|
auto fsm = font_size_keywords.find(key);
|
||||||
if (fsm != font_size_keywords.end()) {
|
if (fsm != font_size_keywords.end()) {
|
||||||
it->set_text(fsm->second);
|
it->set_text(fsm->second);
|
||||||
|
it->set_type(TokenType::dimension);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class TestTransform(SimpleTest):
|
|||||||
s('@import "x.y";', '@import "X.Y";')
|
s('@import "x.y";', '@import "X.Y";')
|
||||||
s('@import url( x.y);', '@import url("X.Y");')
|
s('@import url( x.y);', '@import url("X.Y");')
|
||||||
|
|
||||||
u('background: url( te st.gif ); src: url(x)', 'background: url("TE ST.GIF"); src: url("X")')
|
u('background: url( te st.gif ) 12; src: url(x)', 'background: url("TE ST.GIF") 12; src: url("X")')
|
||||||
u('background: url(test.gif); xxx: url()', 'background: url("TEST.GIF"); xxx: url()')
|
u('background: url(test.gif); xxx: url()', 'background: url("TEST.GIF"); xxx: url()')
|
||||||
u(r'background: url(t\)est.gif)', 'background: url("T)EST.GIF")')
|
u(r'background: url(t\)est.gif)', 'background: url("T)EST.GIF")')
|
||||||
u('a:url( "( )" )', 'a:url("( )")')
|
u('a:url( "( )" )', 'a:url("( )")')
|
||||||
@ -53,6 +53,7 @@ class TestTransform(SimpleTest):
|
|||||||
d(r'''font: 'some \n ame' 32px''', 'font: "some n ame" 2rem')
|
d(r'''font: 'some \n ame' 32px''', 'font: "some n ame" 2rem')
|
||||||
d('''font: 'some \\\nname' 32px''', 'font: "some name" 2rem')
|
d('''font: 'some \\\nname' 32px''', 'font: "some name" 2rem')
|
||||||
d('font: sans-serif 16px/3', 'font: sans-serif 1rem/3')
|
d('font: sans-serif 16px/3', 'font: sans-serif 1rem/3')
|
||||||
|
d('font: sans-serif small/17', 'font: sans-serif 0.8rem/17')
|
||||||
|
|
||||||
d('-epub-writing-mode: a; -webkit-writing-mode: b; writing-mode: c', 'writing-mode: a; writing-mode: b; writing-mode: c')
|
d('-epub-writing-mode: a; -webkit-writing-mode: b; writing-mode: c', 'writing-mode: a; writing-mode: b; writing-mode: c')
|
||||||
d('xxx:yyy', 'xxx:yyy')
|
d('xxx:yyy', 'xxx:yyy')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user