Index: carboncanvas.pp
===================================================================
--- carboncanvas.pp	(revision 12714)
+++ carboncanvas.pp	(working copy)
@@ -102,7 +102,9 @@
     function SaveDC: Integer;
     function RestoreDC(ASavedDC: Integer): Boolean;
     
-    function BeginTextRender(AStr: PChar; ACount: Integer; out ALayout: ATSUTextLayout): Boolean;
+    function BeginTextRender(AStr: PChar; ACount: Integer;
+                             const ADisableFractionalPositions:Boolean;
+                             out ALayout: ATSUTextLayout): Boolean;
     procedure EndTextRender(var ALayout: ATSUTextLayout);
     
     procedure SetAntialiasing(AValue: Boolean);
@@ -593,6 +595,7 @@
   Method:  TCarbonDeviceContext.BeginTextRender
   Params:  AStr    - UTF8 string to render
            ACount  - Count of chars to render
+           ADisableFractionalPositions - whether to disable fractional positions
            ALayout - ATSU layout
   Returns: If the function suceeds
 
@@ -600,8 +603,9 @@
   context to render the text.
   NOTE: Coordination system is set upside-down!
  ------------------------------------------------------------------------------}
-function TCarbonDeviceContext.BeginTextRender(AStr: PChar; ACount: Integer; out
-  ALayout: ATSUTextLayout): Boolean;
+function TCarbonDeviceContext.BeginTextRender(AStr: PChar; ACount: Integer;
+                                              const ADisableFractionalPositions:Boolean;
+                                              out ALayout: ATSUTextLayout): Boolean;
 var
   TextStyle: ATSUStyle;
   TextLength: LongWord;
@@ -646,16 +650,17 @@
     Self, SName, 'ATSUSetLayoutControls', 'LineRotation') then Exit;
 
   // disable fractional positions of glyphs in layout
-  Tag := kATSULineLayoutOptionsTag;
-  DataSize := SizeOf(ATSLineLayoutOptions);
+  if ADisableFractionalPositions then begin
+     Tag := kATSULineLayoutOptionsTag;
+     DataSize := SizeOf(ATSLineLayoutOptions);
 
-  Options := kATSLineFractDisable or kATSLineDisableAutoAdjustDisplayPos or
-    kATSLineDisableAllLayoutOperations or kATSLineUseDeviceMetrics;
-  PValue := @Options;
-  if OSError(ATSUSetLayoutControls(ALayout, 1, @Tag, @DataSize, @PValue),
-    Self, SName, 'ATSUSetLayoutControls', 'LineLayoutOptions') then Exit;
+     Options := kATSLineFractDisable or kATSLineDisableAutoAdjustDisplayPos or
+     kATSLineDisableAllLayoutOperations or kATSLineUseDeviceMetrics;
+     PValue := @Options;
+     if OSError(ATSUSetLayoutControls(ALayout, 1, @Tag, @DataSize, @PValue),
+        Self, SName, 'ATSUSetLayoutControls', 'LineLayoutOptions') then Exit;
+     end;
 
-
   // set layout context
   Tag := kATSUCGContextTag;
   DataSize := SizeOf(CGContextRef);
@@ -837,7 +842,7 @@
 begin
   Result := False;
   
-  if not BeginTextRender(Str, Count, TextLayout) then
+  if not BeginTextRender(Str, Count, Dx<>nil, TextLayout) then
   begin
     // It is possible that the background should be filled even without text;
     if (Options and ETO_OPAQUE) > 0 then
@@ -975,7 +980,7 @@
   Size.cx := 0;
   Size.cy := 0;
 
-  if not BeginTextRender(Str, Count, TextLayout) then Exit;
+  if not BeginTextRender(Str, Count, false, TextLayout) then Exit;
   try
     // finally compute the text dimensions
     if OSError(ATSUGetUnjustifiedBounds(TextLayout, kATSUFromTextBeginning,
@@ -1018,7 +1023,7 @@
 
   // According to the MSDN library, TEXTMETRIC:
   // the average char width is generally defined as the width of the letter x
-  if not BeginTextRender('x', 1, TextLayout) then Exit;
+  if not BeginTextRender('x', 1, false, TextLayout) then Exit;
   try
     if OSError(ATSUGetUnjustifiedBounds(TextLayout, kATSUFromTextBeginning,
           kATSUToTextEnd, TextBefore, TextAfter, Ascent, Descent),
