CrochetCharts icon indicating copy to clipboard operation
CrochetCharts copied to clipboard

new icons displaying very small

Open Neon22 opened this issue 5 years ago • 2 comments

new stitches created in (say) Inkscape 0.92.4 show very small icons when loaded.

Problem is traced to code in stitchset.cpp function StitchSet::data

    if(role == Qt::DisplayRole || role == Qt::EditRole) {
        switch(index.column()) {
            case Stitch::Name:
                return QVariant(s->name());
            case Stitch::Icon: {
                if(role == Qt::DisplayRole) {
                    return QVariant(QSize(s->width(), s->height()));
                } else {
                    return QVariant(s->file());
                }
            }

in originally authored (inkscape 0.48) files the width and height were plain integers (pixels was assumed) and a viewbox was not used. E.g. in sts63.svg

width="38" height="96"

in Inkscape 0.92 etc a viewbox is used and width and height are in units. E.g.

viewBox="0 0 9 10" height="10mm" width="9mm"

So the display needs to use a different size metric so the icons can be seen larger. Perhaps:

  • interpret the dimensioned units, or
  • an integer multiplier of the extracted numbers (but units can be mm,in,px,picas,...) (Pixels now 96dpi FYI)

Neon22 avatar Jan 13 '20 19:01 Neon22

Was hoping to find a workaround by changing the units saved in the inkscape file to one with larger numbers.

In fact found that icons changed size when using different units but no useful size found. Assuming problem is units are fixed somewhere - probably at 90dpi - and all numbers are assumed to be in those units. Not sure though. Something else might be happening.

Neon22 avatar Jan 13 '20 19:01 Neon22

Only workaround is to:

  • use inkscape 0.48.5
  • remove any viewbox entry in a file
  • ensure document and internal measurements are saved in pixels.

Note:

  • (portable version of 0.48.5 so as not to force uninstall of latest version)
    • be sure to download 'portable' if on windows
    • https://inkscape.org/release/0.48.5/platforms/
  • remove viewbox using 'Edit/XML Editor' menu

Until the code can deal with viewboxes and units in the width and height fields correctly.

Neon22 avatar Jan 18 '20 00:01 Neon22