Skip to content

Commit

Permalink
Build with fsize fix
Browse files Browse the repository at this point in the history
  • Loading branch information
linev committed Oct 7, 2024
1 parent 1515b47 commit 7467186
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
47 changes: 30 additions & 17 deletions build/jsroot.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const version_id = 'dev',

/** @summary version date
* @desc Release date in format day/month/year like '14/04/2022' */
version_date = '2/10/2024',
version_date = '7/10/2024',

/** @summary version id and date
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
Expand Down Expand Up @@ -9790,13 +9790,13 @@ function approximateLabelWidth(label, font, fsize) {
/** @summary array defines features supported by latex parser, used by both old and new parsers
* @private */
const latex_features = [
{ name: '#it{' }, // italic
{ name: '#bf{' }, // bold
{ name: '#it{', bi: 'italic' }, // italic
{ name: '#bf{', bi: 'bold' }, // bold
{ name: '#underline{', deco: 'underline' }, // underline
{ name: '#overline{', deco: 'overline' }, // overline
{ name: '#strike{', deco: 'line-through' }, // line through
{ name: '#kern[', arg: 'float' }, // horizontal shift
{ name: '#lower[', arg: 'float' }, // vertical shift
{ name: '#kern[', arg: 'float', shift: 'x' }, // horizontal shift
{ name: '#lower[', arg: 'float', shift: 'y' }, // vertical shift
{ name: '#scale[', arg: 'float' }, // font scale
{ name: '#color[', arg: 'int' }, // font color
{ name: '#font[', arg: 'int' }, // font face
Expand Down Expand Up @@ -10132,7 +10132,7 @@ function parseLatex(node, arg, label, curr) {
elem.attr('fill', curr.color || arg.color || null);

// set font size directly to element to avoid complex control
if (curr.fisze !== curr.font.size)
if (curr.fsize !== curr.font.size)
elem.attr('font-size', Math.round(curr.fsize));

if (curr.font?.isSymbol) {
Expand Down Expand Up @@ -10417,16 +10417,18 @@ function parseLatex(node, arg, label, curr) {
continue;
}

if (found.name === '#bf{' || found.name === '#it{') {
if (found.bi) { // bold or italic
const sublabel = extractSubLabel();
if (sublabel === -1) return false;
if (sublabel === -1)
return false;

const subpos = createSubPos();

if (found.name === '#bf{')
subpos.bold = !subpos.bold;
else
subpos.italic = !subpos.italic;
let value;
for (let c = curr; c && (value === undefined && c); c = c.parent)
value = c[found.bi];

subpos[found.bi] = !value;

parseLatex(currG(), arg, sublabel, subpos);

Expand All @@ -10453,7 +10455,7 @@ function parseLatex(node, arg, label, curr) {
label = label.slice(pos + 2);
}

if ((found.name === '#kern[') || (found.name === '#lower[')) {
if (found.shift) {
const sublabel = extractSubLabel();
if (sublabel === -1) return false;

Expand All @@ -10462,9 +10464,12 @@ function parseLatex(node, arg, label, curr) {
parseLatex(currG(), arg, sublabel, subpos);

let shiftx = 0, shifty = 0;
if (found.name === 'kern[') shiftx = foundarg; else shifty = foundarg;
if (found.shift === 'x')
shiftx = foundarg * subpos.rect.width;
else
shifty = foundarg * subpos.rect.height;

positionGNode(subpos, curr.x + shiftx * subpos.rect.width, curr.y + shifty * subpos.rect.height);
positionGNode(subpos, curr.x + shiftx, curr.y + shifty);

shiftX(subpos.rect.width * (shiftx > 0 ? 1 + foundarg : 1));

Expand All @@ -10479,6 +10484,11 @@ function parseLatex(node, arg, label, curr) {
subpos = createSubPos();

gg.attr('href', foundarg);
if (!isBatchMode()) {
gg.on('mouseenter', () => gg.style('text-decoration', 'underline'))
.on('mouseleave', () => gg.style('text-decoration', null))
.append('svg:title').text(`link on ${foundarg}`);
}

parseLatex(gg, arg, sublabel, subpos);

Expand Down Expand Up @@ -147115,8 +147125,11 @@ async function drawText$1() {
fact = 0.8;
}

if (is_url)
this.draw_g.attr('href', text.fName).append('title').text(`Link on ${text.fName}`);
if (is_url) {
this.draw_g.attr('href', text.fName);
if (!this.isBatchMode())
this.draw_g.append('svg:title').text(`link on ${text.fName}`);
}

return this.startTextDrawingAsync(this.textatt.font, this.textatt.getSize(w, h, fact, 0.05))
.then(() => this.drawText(arg))
Expand Down
2 changes: 1 addition & 1 deletion modules/core.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const version_id = 'dev',

/** @summary version date
* @desc Release date in format day/month/year like '14/04/2022' */
version_date = '2/10/2024',
version_date = '7/10/2024',

/** @summary version id and date
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
Expand Down

0 comments on commit 7467186

Please sign in to comment.