Skip to content

Commit 5792546

Browse files
committed
Fix Text decoration accepted values
Before this fix, Small-caps was the accepted value. After the fix only the following values are accepted: underline, overline, line-through, blink. In case no value is specified, the default(none) is used. Fixes gliffy#90.
1 parent eaab317 commit 5792546

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

canvas2svg.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,14 @@
902902
* @private
903903
*/
904904
ctx.prototype.__parseFont = function () {
905-
var regex = /^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z0-9]+?)\s*$/i;
905+
var regex = /^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(underline|overline|line-through|blink))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z0-9]+?)\s*$/i;
906906
var fontPart = regex.exec( this.font );
907907
var data = {
908908
style : fontPart[1] || 'normal',
909909
size : fontPart[4] || '10px',
910910
family : fontPart[6] || 'sans-serif',
911911
weight: fontPart[3] || 'normal',
912-
decoration : fontPart[2] || 'normal',
912+
decoration : fontPart[2] || 'none',
913913
href : null
914914
};
915915

0 commit comments

Comments
 (0)