A little more info for this issue.
Modified unit BGRACanvas2D and added property to TBGRACanvas2D
property currState:TBGRACanvasState2D read currentState;
Original example code modified to,
a := ctx.currState;
ctx.save;
ctx.restore;
b := ctx.currState;
Inspecting 'a' and 'b' shows 'TEXTBASELINE' changed to 'alphabetic' from 'top', see images below.
TBGRACanvas2D.Save calls TBGRACanvasState2D.Duplicate to create copy of current state, it does not copy 'textBaseline'. I've added code to copy this value which resolves this issue.
result.fontStyle := fontStyle;
result.textDirection:= textDirection;
result.textBaseline:=textBaseline; // Mod by Coxy
result.lineWidth := lineWidth;
result.penStroker.LineCap := penStroker.LineCap;
Is this a valid fix or was the value not copied for some obscure reason?
Other members that have changed are 'FCLIPMASKOWNED' and 'PENSTROKER'.