Community
Participate
Working Groups
Created attachment 270304 [details] SampleWithSpecificFont.zip Since the auto-scaling of export as image (bug 507056 and bug 521467), there is problem with figure using unknown Font. The label is not visible for this figure when the "auto-scale" is enabled. Steps to reproduce: * Import project SampleWithSpecificFont (from SampleWithSpecificFont.zip) * Open diagramA * Export it as image without the auto-scale (you get something like diagramA.jpg) => OK * Export it as image with the auto-scale (you get something like diagramA-autoScaling.jpg, better resolution and bigger than previous) => OK * Open diagramB * Export it as image without the auto-scale (you get something like diagramB.jpg) => OK * Export it as image with the auto-scale (you get something like diagramB-autoScaling.jpg, better resolution and bigger than previous) => KO, the label is not visible
Created attachment 270305 [details] diagramA.jpg
Created attachment 270306 [details] diagramA-autoScaling.jpg
Created attachment 270307 [details] diagramB.jpg
Created attachment 270308 [details] diagramB-autoScaling.jpg
Here is a preliminary analysis. During the export of the DiagramA and DiagramB, I observed the Font characteristic with a breakpoint here Thread [main] (Suspended) owns: ExportAction (id=17486) GC.drawText(long, char[], int, int, int, int, int, int, TEXTMETRIC, boolean) line: 2639 GC.drawText(long, String, int, int, int, Point) line: 2582 GC.drawTextInPixels(String, int, int, int) line: 2434 GC.drawTextInPixels(String, int, int, boolean) line: 2384 GC.drawText(String, int, int, boolean) line: 2378 SWTGraphics.drawText(String, int, int) line: 529 SWTGraphics(Graphics).drawText(String, Point) line: 426 RenderedMapModeGraphics(ScaledGraphics).drawText(String, int, int) line: 392 SiriusWrapLabel.paintText(Graphics, String) line: 1187 SiriusWrapLabel.paintFigure(Graphics) line: 1122 SiriusWrapLabel(Figure).paint(Graphics) line: 1118 SquareEditPart$SquareFigure(Figure).paintChildren(Graphics) line: 1170 SquareEditPart$SquareFigure(Figure).paintClientArea(Graphics) line: 1205 SquareEditPart$SquareFigure(Figure).paint(Graphics) line: 1120 AirStyleDefaultSizeNodeFigure(Figure).paintChildren(Graphics) line: 1170 AirStyleDefaultSizeNodeFigure(Figure).paintClientArea(Graphics) line: 1205 AirStyleDefaultSizeNodeFigure(Figure).paint(Graphics) line: 1120 AirDefaultSizeNodeFigure(Figure).paintChildren(Graphics) line: 1170 AirDefaultSizeNodeFigure(Figure).paintClientArea(Graphics) line: 1205 AirDefaultSizeNodeFigure(Figure).paint(Graphics) line: 1120 DBorderedNodeFigure(Figure).paintChildren(Graphics) line: 1170 DBorderedNodeFigure(Figure).paintClientArea(Graphics) line: 1205 DBorderedNodeFigure(Figure).paint(Graphics) line: 1120 SiriusDiagramImageGenerator(DiagramGenerator).paintFigure(Graphics, IFigure) line: 373 SiriusDiagramImageGenerator(DiagramGenerator).renderToGraphics(Graphics, Point, List) line: 226 SiriusDiagramImageGenerator(DiagramGenerator).createSWTImageDescriptorForParts(List, Rectangle) line: 721 DiagramEditPartService.copyToImage(DiagramGenerator, List, Rectangle, IPath, ImageFileFormat, IProgressMonitor) line: 361 DiagramEditPartService(CopyToImageUtil).copyToImage(DiagramEditPart, IPath, ImageFileFormat, IProgressMonitor) line: 305 DiagramEditPartService.copyToImage(DiagramEditPart, IPath, ImageFileFormat, IProgressMonitor) line: 247 DiagramDialectUIServices.export(DRepresentation, Session, IPath, ExportFormat, IProgressMonitor, boolean) line: 463 DialectUIManagerImpl.export(DRepresentation, Session, IPath, ExportFormat, IProgressMonitor, boolean) line: 268 ExportAction.createImageFiles(IProgressMonitor) line: 198 ExportAction.execute(IProgressMonitor) line: 117 ExportAction(WorkspaceModifyOperation).lambda$0(InvocationTargetException[], IProgressMonitor) line: 107 By forcing a factor of 5, ie method org.eclipse.sirius.diagram.ui.tools.api.part.DiagramEditPartService.getExportResolutionFactor(DiagramEditPart, SiriusDiagramImageGenerator) always returns 5: * the variable points for known Font ("Comic Sans MS") in DiagramA is [38.0, 54.0, 48.0, 54.0, 54.0, 54.0, 61.0, 54.0, 64.0, 54.0, 70.0, 54.0, 75.0, 54.0] * the variable points for unknown Font ("UnknownFontName") in DiagramB is [40.0, 95.0, 86.0, 95.0, 114.0, 95.0, 154.0, 95.0, 167.0, 95.0, 198.0, 95.0, 226.0, 95.0] * the space bewteen each character is higher for unknown Font and the y location is also higher. By forcing a factor of 10, * the variable points for known Font ("Comic Sans MS") in DiagramA is the same as for factor of 5. * the variable points for unknown Font ("UnknownFontName") in DiagramB is not the same. This is caused by the characteristic of the Font: "TEXTMETRIC lptm". With factor of 5 or of 10, for font "Comic Sans MS", there are: * Ascent = 12 * Descent = 3 * AveCharWidth = 5 * Height = 15 * InternalLeading = 4 * MaxCharWidth = 35 With factor of 5, for unknown font "UnknownFontName", there are: * Ascent = 51 * Descent = 12 * AveCharWidth = 24 * Height = 63 * InternalLeading = 8 * MaxCharWidth = 113 With factor of 5, for unknown font "UnknownFontName", there are: * Ascent = 101 * Descent = 23 * AveCharWidth = 48 * Height = 124 * InternalLeading = 14 * MaxCharWidth = 226 Is seems that the factor has an impact on the Font characteristic and it should not.
I cannot reproduce this issue on linux
I followed Laurent's scenario using Windows and reproduced the issue when exporting diagramB with the auto-scale. There was no label on the image.