@@ -19350,14 +19350,23 @@ proto.update = function(options) {
19350
19350
var x = tick.x
19351
19351
var text = tick.text
19352
19352
var font = tick.font || 'sans-serif'
19353
+ var fontStyle = tick.fontStyle || 'normal'
19354
+ var fontWeight = tick.fontWeight || 'normal'
19355
+ var fontStretch = tick.fontStretch || 'normal'
19356
+ var fontVariant = tick.fontVariant || 'normal'
19353
19357
scale = (tick.fontSize || 12)
19354
19358
19355
19359
var coordScale = 1.0 / (bounds[dimension+2] - bounds[dimension])
19356
19360
var coordShift = bounds[dimension]
19357
19361
19358
19362
var rows = text.split('\n')
19359
19363
for(var r = 0; r < rows.length; r++) {
19360
- data = getText(font, rows[r]).data
19364
+ data = getText(font, rows[r], {
19365
+ fontStyle: fontStyle,
19366
+ fontWeight: fontWeight,
19367
+ fontStretch: fontStretch,
19368
+ fontVariant: fontVariant
19369
+ }).data
19361
19370
for (j = 0; j < data.length; j += 2) {
19362
19371
vertices.push(
19363
19372
data[j] * scale,
@@ -19378,7 +19387,14 @@ proto.update = function(options) {
19378
19387
for(dimension=0; dimension<2; ++dimension) {
19379
19388
this.labelOffset[dimension] = Math.floor(vertices.length/3)
19380
19389
19381
- data = getText(options.labelFont[dimension], options.labels[dimension], { textAlign: 'center' }).data
19390
+ data = getText(options.labelFont[dimension], options.labels[dimension], {
19391
+ fontStyle: options.labelFontStyle[dimension],
19392
+ fontWeight: options.labelFontWeight[dimension],
19393
+ fontStretch: options.labelFontStretch[dimension],
19394
+ fontVariant: options.labelFontVariant[dimension],
19395
+ textAlign: 'center'
19396
+ }).data
19397
+
19382
19398
scale = options.labelSize[dimension]
19383
19399
for(i=0; i<data.length; i+=2) {
19384
19400
vertices.push(data[i]*scale, -data[i+1]*scale, 0)
@@ -19390,7 +19406,12 @@ proto.update = function(options) {
19390
19406
19391
19407
//Add title
19392
19408
this.titleOffset = Math.floor(vertices.length/3)
19393
- data = getText(options.titleFont, options.title).data
19409
+ data = getText(options.titleFont, options.title, {
19410
+ fontStyle: options.titleFontStyle,
19411
+ fontWeight: options.titleFontWeight,
19412
+ fontStretch: options.titleFontStretch,
19413
+ fontVariant: options.titleFontVariant,
19414
+ }).data
19394
19415
scale = options.titleSize
19395
19416
for(i=0; i<data.length; i+=2) {
19396
19417
vertices.push(data[i]*scale, -data[i+1]*scale, 0)
@@ -19927,9 +19948,18 @@ proto.update = function(options) {
19927
19948
labels: options.labels || ['x', 'y'],
19928
19949
labelSize: options.labelSize || [12,12],
19929
19950
labelFont: options.labelFont || ['sans-serif', 'sans-serif'],
19951
+ labelFontStyle: options.labelFontStyle || ['normal', 'normal'],
19952
+ labelFontWeight: options.labelFontWeight || ['normal', 'normal'],
19953
+ labelFontStretch: options.labelFontStretch || ['normal', 'normal'],
19954
+ labelFontVariant: options.labelFontVariant || ['normal', 'normal'],
19955
+
19930
19956
title: options.title || '',
19931
19957
titleSize: options.titleSize || 18,
19932
- titleFont: options.titleFont || 'sans-serif'
19958
+ titleFont: options.titleFont || 'sans-serif',
19959
+ titleFontStyle: options.titleFontStyle || 'normal',
19960
+ titleFontWeight: options.titleFontWeight || 'normal',
19961
+ titleFontStretch: options.titleFontStretch || 'normal',
19962
+ titleFontVariant: options.titleFontVariant || 'normal'
19933
19963
})
19934
19964
19935
19965
this.static = !!options.static;
@@ -40224,9 +40254,23 @@ function unwrap(mesh) {
40224
40254
40225
40255
function textGet(font, text, opts) {
40226
40256
var opts = opts || {}
40227
- var fontcache = __TEXT_CACHE[font]
40257
+
40258
+ var fontStyle = opts.fontStyle || 'normal'
40259
+ var fontWeight = opts.fontWeight || 'normal'
40260
+ var fontStretch = opts.fontStretch || 'normal'
40261
+ var fontVariant = opts.fontVariant || 'normal'
40262
+
40263
+ var fontKey = [
40264
+ fontStyle,
40265
+ fontWeight,
40266
+ fontStretch,
40267
+ fontVariant,
40268
+ font
40269
+ ].join('_')
40270
+
40271
+ var fontcache = __TEXT_CACHE[fontKey]
40228
40272
if(!fontcache) {
40229
- fontcache = __TEXT_CACHE[font ] = {
40273
+ fontcache = __TEXT_CACHE[fontKey ] = {
40230
40274
' ': {
40231
40275
data: new Float32Array(0),
40232
40276
shape: 0.2
@@ -40239,6 +40283,10 @@ function textGet(font, text, opts) {
40239
40283
mesh = fontcache[text] = unwrap(vectorizeText(text, {
40240
40284
triangles: true,
40241
40285
font: font,
40286
+ fontStyle: fontStyle,
40287
+ fontWeight: fontWeight,
40288
+ fontStretch: fontStretch,
40289
+ fontVariant: fontVariant,
40242
40290
textAlign: opts.textAlign || 'left',
40243
40291
textBaseline: 'alphabetic',
40244
40292
styletags: {
0 commit comments