TMS FNC Core 4.5.0.0 - PDF: filled round rectangle without stroke is not drawn, and SVG fill-rule is ignored (screen and PDF differ)

Thanks, Pieter. I installed FNC Core 4.5.0.1 together with Gantt 1.3.3.11 and ran the demo from this thread again: in scene 1, rectangle B is now drawn in the PDF. In scene 2, the PDF now shows A with a hole, B filled and C with a hole, and on screen B is filled as well. So both issues are fixed, thank you.

Unfortunately the SVG changes in 4.5.0.1 cause a new problem in our application, which also uses TMS VCL UI Pack 13.7.0.0 (Delphi 13.1, VCL, Win64). As soon as a Gantt task list with a summary task is painted, there is an access violation in TTMSFNCGraphicsSVGImport.InternalDraw, line 3055 (if est.DisplayValue = 'none' then), while the expand/collapse icon is drawn:

System._UStrEqual
TTMSFNCGraphicsSVGImport.InternalDraw
TTMSFNCGraphicsSVGImport.InternalDraw
TTMSFNCGraphicsSVGImport.Draw
TTMSFNCGraphics.DrawSVG
TTMSFNCGraphics.DrawBitmap
TTMSFNCGraphics.DrawBitmap
TTMSFNCCustomGanttChart.DoOnTaskListBeforeDrawNodeExpand
TTMSFNCCustomGanttList.DoBeforeDrawNodeExpand
...

With FNC Core 4.5.0.0 / Gantt 1.3.3.10 the same application works. As far as we can see, this is the cause:

  1. AdvTypes.pas (VCL UI Pack) declares IAdvSVGBitmap with the same GUID as ITMSFNCSVGBitmap in VCL.TMSFNCTypes.pas: {3A7B5F92-C4E1-4D8A-B623-0F1E7A9D4C85}.
  2. Both units declare a class named TTMSFNCSVGBitmap (in AdvTypes it is class(TAdvSVGBitmap)) and register it with RegisterClass and TPicture.RegisterFileFormat('SVG', ...), but only if no class with this name is registered yet. So the unit that is initialized first wins. In our application this is AdvTypes.
  3. TTMSFNCGraphics.DrawSVG gets the SVG with Supports(ABitmap.Graphic, ITMSFNCSVGBitmap, ISVGBitmap) and casts the result of GetSVG to TTMSFNCGraphicsSVGImport. With the UI Pack class registered, it is a TAdvGraphicsSVGImport. In the debugger, the element list being drawn belongs to AdvGraphicsSVGEngine.
  4. In VCL UI Pack 13.7.0.0, the declarations of TAdvGraphicsSVGImport and TAdvGraphicsSVGElement are identical to TTMSFNCGraphicsSVGImport and TTMSFNCGraphicsSVGElement of FNC Core 4.5.0.0 (apart from the prefix), so this worked until now. FNC Core 4.5.0.1 added five fields to TTMSFNCGraphicsSVGElement (FStrokeDashArrayValue, FStrokeDashOffsetValue, FStrokeLineCapValue, FFillRuleValue, FClipRuleValue). The FNC code now reads the UI Pack objects at the wrong offsets.

Demo (attached), built as Win64 Debug. Both projects use the same form. The first log line shows which unit registered TTMSFNCSVGBitmap, and exceptions are shown and written to the log.

  • SVGExpandIcon.dpr uses FNC only. Button 1 loads the Gantt expand icon SVG (TTMSFNCGANTTLISTEXPANDNEWSVG) into a TTMSFNCBitmap and draws it with TTMSFNCGraphics.DrawBitmap. Button 2 shows a Gantt chart with one summary task. Both work, the icons are drawn:
TTMSFNCSVGBitmap registered from unit: VCL.TMSFNCTypes
1. DrawBitmap
   loaded, graphic class: TTMSFNCSVGBitmap (unit VCL.TMSFNCTypes)
   drawing ...
   OK
2. Gantt with summary task
   OK
  • SVGExpandIconUIPack.dpr is the same, the only difference is AdvTypes as the first unit in the uses clause. Button 1 raises the access violation (German Windows):
TTMSFNCSVGBitmap registered from unit: AdvTypes
1. DrawBitmap
   loaded, graphic class: TTMSFNCSVGBitmap (unit AdvTypes)
   drawing ...
   EAccessViolation: Zugriffsverletzung bei Adresse 00007FF66D8937AD in Modul 'SVGExpandIconUIPack.exe' (Offset 137AD). Lesen von Adresse FFFFFFFFFFFFFFFF

In the debugger the call stack is the one above, from TTMSFNCGraphics.DrawBitmap down to System._UStrEqual.

Questions:

  1. Is there (or will there be) a VCL UI Pack version whose SVG engine matches FNC Core 4.5.0.1? Which versions of the two products belong together?
  2. Could the products avoid casting each other's objects (separate GUIDs and class names, or a check of the actual class before the cast)? Today an update of one product can break the other at runtime, without any compiler error.
  3. Until then: is Gantt 1.3.3.11 supported with FNC Core 4.5.0.0?

Versions: Delphi 13.1, TMS FNC Core 4.5.0.1, TMS FNC Gantt Chart 1.3.3.11, TMS VCL UI Pack 13.7.0.0, all installed with TMS Smart Setup.

Thanks!

SVGExpandIcon_Demo.zip (7.1 KB)