|
|
@ -42,10 +42,24 @@ exports.cairoVersion = cairoVersion; |
|
|
|
var cache = {}; |
|
|
|
|
|
|
|
/** |
|
|
|
* Font RegExp used by parseFont(); |
|
|
|
* Font RegExp helpers. |
|
|
|
*/ |
|
|
|
|
|
|
|
var font = /^ *(?:(normal|bold|bolder|lighter|[1-9](?:00)) *)?(?:(normal|italic|oblique) *)?(\d+)(px|pt|pc|in|cm|mm|%) *((?:"([^"]+)"|[\w-]+)( *, *(?:"([^"]+)"|[\w-]+))*)/; |
|
|
|
var weights = 'normal|bold|bolder|lighter|[1-9](?:00)' |
|
|
|
, styles = 'normal|italic|oblique' |
|
|
|
, units = 'px|pt|pc|in|cm|mm|%' |
|
|
|
, string = '"([^"]+)"|[\\w-]+'; |
|
|
|
|
|
|
|
/** |
|
|
|
* Font parser RegExp; |
|
|
|
*/ |
|
|
|
|
|
|
|
var font = new RegExp('^ *' |
|
|
|
+ '(?:(' + weights + ') *)?' |
|
|
|
+ '(?:(' + styles + ') *)?' |
|
|
|
+ '(\\d+)(' + units + ') *' |
|
|
|
+ '((?:' + string + ')( *, *(?:' + string + '))*)' |
|
|
|
); |
|
|
|
|
|
|
|
/** |
|
|
|
* Buffer extensions. |
|
|
|