Outils pour utilisateurs

Outils du site


issue202:inkscape

Ceci est une ancienne révision du document !


This month, I’ll begin with a small correction, courtesy of @dwhall on the Inkscape forum (https://inkscape.org/forums/). Previously I described the new ability to set the origin point for Selector tool transformations – i.e. the point that remains fixed when you change the width or height via the numeric fields in the tool control bar. I said that it was a shame that there’s no way to choose the center-center point as the reference. It turns out there is, but not while the Selector tool is in its default move/resize mode. Instead, you have to click on the object a second time to switch to the scale/rotate handles. Once in that mode, a single click on the handle that marks the center of rotation will display the blue color and barely visible lines that indicate it’s being used as the reference point. This also means that the reference point can be moved to an arbitrary position by dragging the handle (Shift-Click on it to return it to the center of the bounding box), but suffers from a long-standing omission in this regard in that there’s no way to set the position by typing values in, except via the not-so-user-friendly XML editor. In addition, none of the other rotate/skew handles can be clicked to set the reference point, so if you want to switch it to one of the corners, for example, you’ll need to cycle back round to the move/resize mode.

I sincerely hope that the Inkscape developers make these three small additions in a future release to unify this new functionality across the different modes of the Selector tool: • Add a visible center handle to the move/resize mode, similar to the center of rotation • Add fields for explicitly entering the reference coordinates to the tool control bar • Allow all the scale/rotate handles to be selected as reference points Document Resources Dialog This dialog is a new addition to version 1.3, and provides a single place to view the various ‘assets’ that are used in your document. An asset, in this case, is one of the following types of element: • Fonts • Styles • Colors • Swatches • Gradients • Filters • Patterns • Symbols • Markers • Images • External references (i.e. links to URLs) • Metadata

There’s an absolute trove of information in this dialog, as can be seen from the default ‘Overview’ pane that appears when it’s first opened via File > Document Resources. To the left of the dialog you can see a list of the various categories of information available, beginning with the Overview pane that is currently selected. Categories appear in this list only if they have content to display, so you won’t be faced with a useless ‘Symbols’ category if your document doesn’t contain any symbols, for example. To the right of this list is the main content of the dialog, which often displays information in a tabular form, as can be seen with the Overview. Unfortunately, the cells of these tables are not only read-only, but also don’t allow their contents to be copied to the clipboard. There’s also no option to export them to a file for further processing or analysis. A command-line mechanism for opening a drawing in a headless Inkscape instance and exporting a JSON file from this dialog would open up a lot of possibilities for indexing or exploring any large corpus of SVG files.

Looking at the overview pane, you can see some immediately useful information about the document path, the licence and the total number of elements. A lot of the other information, however, just duplicates the list of categories on the left. There’s no interactivity in the overview table, either: clicking or double-clicking on one of those entries is in vain, as it doesn’t take you to the relevant category pane, and certainly doesn’t open the appropriate dialog on the screen. For example, it would be great on noticing that I’ve failed to add a licence, to be able to double-click on the second row as a shortcut to open the Document Properties dialog with the relevant tab selected, but this dialog doesn’t currently provide that sort of capability. Above the main pane is a toolbar whose contents change depending on the selected pane. In all cases the button and search box on the right remain present. The button – which has an icon that looks like a vacuum cleaner, in my theme – will remove any definitions that are present in the file, but not used in the actual drawing. As an example, this can happen when you create gradients on objects then change them to a different fill, or delete the objects entirely. If that sounds familiar, it’s because there is already a File > Clean Up Document menu item which performs the same task. In fact, if you have the ‘Show icons in menus’ option enabled in the Theming pane of the Preferences dialog, you’ll probably already recognise the icon in this button.

The search box in the toolbar is actually more of a filter, in that it just restricts the entries in the current pane to those that match the search string. It doesn’t search across all the panes in the dialog. This is a simple case-insensitive substring search that doesn’t support any wildcards, which somewhat limits its usefulness (e.g. no searching for ‘??ff??’ in the Colors pane to find all the colors with 100% green). I won’t go through every pane in this dialog, as many show just tabular information. But I will take a look at some that do offer some additional functionality, starting with the aforementioned Colors pane. This pane shows a grid of color swatches, each with its hexadecimal RGB value beneath it. Remember, no matter what color picker you use, Inkscape stores values internally as RGB, so don’t go expecting to see your HSL values in here. Also note that these are 6-digit hex values, so any transparency in your colors is omitted. This is a pity, because the difference between a fully opaque and a nearly transparent color is stark, so this view might grossly misrepresent the colors that are actually visible in your image.

You can’t edit the hex values from here; you can’t double-click to open a color picker to change any of the colors interactively; you can’t even drag a swatch to the canvas to set the fill or stroke on your selected object. This is purely a report of the colors used in your image, in ascending hex order, not a tool for working with them. There is, however, one small bit of additional functionality in this pane, offered by the button in the toolbar. Clicking that will export a palette of the colors in *.gpl format – the palette format used by The Gimp and some other tools, as well as by Inkscape itself. But before you get too excited about this function, note that it will always export the entire list of colors. There’s no way to select a subset of the swatches in the pane to produce a more limited palette. The Fonts pane is a useful little tool, showing a list of the fonts used in your document, but doing so with two entries per font: the first shows the font name rendered at a fairly large size using the font itself, while the second shows it as plain text.

This is great for getting an overview of the fonts you’re using, and the preview makes it easier to identify whether each font is a serif, sans-serif, display font, and so on. Showing the font name as plain text also helps when dealing with dingbat fonts, or extremely fancy or cursive fonts where the fully rendered version might be hard to read. Unfortunately color fonts don’t appear in color (e.g. Gilbert Color in the screenshot). Even if there are technical reasons why they can’t be rendered in color in here, it would be nice to at least have some flag or indicator to show that they’re color fonts. In fact, a little more metadata about the fonts would be nice to have in here generally. The Gradients, Markers, Patterns, Swatches and Symbols panes all share some common toolbar buttons, as seen here in the Markers pane.

Unfortunately there only seems to be a symbolic icon for the first button – at least in my 1.3.2 AppImage downloaded directly from the Inkscape website. All other themes show some sort of ‘missing image’ icon. For reference, the symbolic icon for this is a pencil. The buttons are enabled only when an item in the pane is selected. Clicking the first will let you edit the label of the item; double-clicking on the item label directly also achieves the same result. I’ll make my usual clarification that the label is purely an informative thing that Inkscape offers. It’s not part of the SVG spec (it’s stored as an attribute in the Inkscape namespace), and changing this won’t alter the ID, which makes it less useful for JavaScript developers. But if you want some of your assets to have user-friendly labels – perhaps to make them easier to reuse – you can rename them in bulk (albeit one at a time) in this dialog.

The tooltip for the second button in the toolbar claims that it will “Select this on canvas (if applicable) or in the XML dialog (e.g. a pattern in the ‘defs’ section)”. In my experience, this should probably be reworded to be the other way round: it will actually select the item in the XML dialog, if it’s already open, and very occasionally also select an element on the canvas. The reason for this is that most of the items in these panes refer to internal definitions that don’t have a direct on-canvas object associated with them. Selecting the definition in the XML editor makes sense in that case – though it’s not something that’s likely to be terribly useful for most people. Only if the item is actually represented directly on-canvas will the corresponding object be selected. This will not be the case for any of the panes I listed above though it may be for images, which I’ll discuss further below. The last button on the toolbar deletes the selected item from the file. This will not always have the effect you expect. Deleting a Swatch, for example, will remove the fill or stroke color from any objects that use it – no surprise there. But deleting a Symbol won’t remove it from your canvas; instead the symbol is converted to a group of normal objects, the same as if you’d selected it on the canvas and used Edit > Clone > Unlink Clone.

There’s one more pane that features all three of these toolbar buttons, plus one additional entry: the Images pane. The extra button here lets you directly export the selected image to disk. This is the same functionality that is present in the Image Properties dialog on the right-click context menu for images, but it’s useful to have it in the Document Resources dialog too, particularly if you have to extract multiple images from a single document. The remaining panes – for Metadata and Styles – just show data in a tabular form, with no additional tools or features. Again, this is rather frustrating. The lack of even a means to copy the text to the clipboard seems odd, and trying to show long CSS definitions in a single row in a table isn’t terribly usable. At least the search field can be used to narrow down the list of styles, if you’re looking for something specific. But the lack of wildcards makes even this tricky. Perhaps the developers should reuse the pop-up editor for styles that is present in the XML editor, which at least breaks the long string down into its constituent parts.

It may seem as though I’ve done little but complain in this article, but the truth is that I really like the idea of a Document Resources dialog. I just wish that the implementation went a little further, with a few more convenience features that would make this more of a go-to dialog for working with resources in bulk. As it stands, it’s mostly a reporting tool that doesn’t actually produce reports, rather than something I think I’ll be using regularly. But this is the first appearance of this dialog in Inkscape, and I can only hope that the developers will iterate on it over time, adding more functionality. It also seems like it might be a useful target for new Inkscape developers, as there’s scope for some simple and isolated additions (such as the ability to copy text from the tables) which would probably make a good choice for someone’s first contribution to the project. Although this is the only brand-new dialog in version 1.3, several others have seen changes and improvements which I’ll look at next month.

issue202/inkscape.1709013618.txt.gz · Dernière modification : 2024/02/27 07:00 de d52fr