Compare commits

...
Author SHA1 Message Date
Kara Engelhardt adff182f2d Fix pdf editor crashing if font is missing (Z#23254593)
To reproduce, create a layout with a textcontainer with an unknown font name, then edit the content of that textcontainer. Since the font is unknown, the value of the fontfamily-select-element is null, which breaks fabric's font rendering, which assumes that the fontFamily is always a string
2026-11-19 20:10:04 +01:00
@@ -87,7 +87,7 @@ fabric.Textcontainer = fabric.util.createClass(fabric.Rect, {
fontSize: fontSize,
lineHeight: this.lineHeight,
fill: this.fill,
fontFamily: this.fontFamily,
fontFamily: this.fontFamily || '',
fontWeight: this.fontWeight,
fontStyle: this.fontStyle,
text: text,
@@ -377,7 +377,7 @@ var editor = {
o.set('fill', 'rgb(' + d.color[0] + ',' + d.color[1] + ',' + d.color[2] + ')')
o.set('fontSize', editor._pt2px(d.fontsize))
o.set('lineHeight', d.lineheight || 1)
o.set('fontFamily', d.fontfamily)
o.set('fontFamily', d.fontfamily || '')
o.set('fontWeight', d.bold ? 'bold' : 'normal')
o.set('fontStyle', d.italic ? 'italic' : 'normal')
o.content = d.content
@@ -407,7 +407,7 @@ var editor = {
o.set('fill', 'rgb(' + d.color[0] + ',' + d.color[1] + ',' + d.color[2] + ')')
o.set('fontSize', editor._pt2px(d.fontsize))
o.set('lineHeight', d.lineheight || 1)
o.set('fontFamily', d.fontfamily)
o.set('fontFamily', d.fontfamily || '')
o.set('fontWeight', d.bold ? 'bold' : 'normal')
o.set('fontStyle', d.italic ? 'italic' : 'normal')
o.downward = d.downward || false
@@ -812,7 +812,7 @@ var editor = {
o.set('fill', $('#toolbox-col').val())
o.set('fontSize', editor._pt2px($('#toolbox-fontsize').val()))
o.set('lineHeight', $('#toolbox-lineheight').val() || 1)
o.set('fontFamily', $('#toolbox-fontfamily').val())
o.set('fontFamily', $('#toolbox-fontfamily').val() || '')
o.set('fontWeight', $('#toolbox').find('button[data-action=bold]').is('.active') ? 'bold' : 'normal')
o.set('fontStyle', $('#toolbox').find('button[data-action=italic]').is('.active') ? 'italic' : 'normal')
var align = $('#toolbox-align').find('.active').attr('data-action')
@@ -856,7 +856,7 @@ var editor = {
o.set('fill', $('#toolbox-col').val())
o.set('fontSize', editor._pt2px($('#toolbox-fontsize').val()))
o.set('lineHeight', $('#toolbox-lineheight').val() || 1)
o.set('fontFamily', $('#toolbox-fontfamily').val())
o.set('fontFamily', $('#toolbox-fontfamily').val() || '')
o.set('fontWeight', $('#toolbox').find('button[data-action=bold]').is('.active') ? 'bold' : 'normal')
o.set('fontStyle', $('#toolbox').find('button[data-action=italic]').is('.active') ? 'italic' : 'normal')
var align = $('#toolbox-align').find('.active').attr('data-action')