Browse Source

wasm: fixed compile

mattias 1 year ago
parent
commit
58ddf274df
1 changed files with 16 additions and 4 deletions
  1. 16 4
      src/wasm/fresnel.wasm.font.pp

+ 16 - 4
src/wasm/fresnel.wasm.font.pp

@@ -33,17 +33,19 @@ Type
   public
     Engine: TFresnelWasmFontEngine;
     Family: string;
-    Kerning: string;
+    Kerning: TFresnelCSSKerning;
     Size: double;
     Style: string;
     Variant_: string;
     Weight: double;
+    Width: double;
     function GetFamily: string;
-    function GetKerning: string;
+    function GetKerning: TFresnelCSSKerning;
     function GetSize: TFresnelLength;
     function GetStyle: string;
     function GetVariant: string;
     function GetWeight: TFresnelLength;
+    function GetWidth: TFresnelLength;
     function TextSize(const aText: string): TFresnelPoint; virtual;
     function TextSizeMaxWidth(const aText: string; MaxWidth: TFresnelLength): TFresnelPoint; virtual;
     function GetTool: TObject;
@@ -84,9 +86,11 @@ begin
   if Result<>0 then exit;
   Result:=CompareValue(Font1.Weight,Font2.Weight);
   if Result<>0 then exit;
+  Result:=CompareValue(Font1.Width,Font2.Width);
+  if Result<>0 then exit;
   Result:=CompareText(Font1.Variant_,Font2.Variant_);
   if Result<>0 then exit;
-  Result:=CompareText(Font1.Kerning,Font2.Kerning);
+  Result:=CompareValue(ord(Font1.Kerning),ord(Font2.Kerning));
 end;
 
 function CompareFresnelFontDescWithWasmFont(Key, Item: Pointer): integer;
@@ -106,9 +110,11 @@ begin
   if Result<>0 then exit;
   Result:=CompareValue(Desc^.Weight,aFont.Weight);
   if Result<>0 then exit;
+  Result:=CompareValue(Desc^.Width,aFont.Width);
+  if Result<>0 then exit;
   Result:=CompareText(Desc^.Variant_,aFont.Variant_);
   if Result<>0 then exit;
-  Result:=CompareText(Desc^.Kerning,aFont.Kerning);
+  Result:=CompareValue(ord(Desc^.Kerning),ord(aFont.Kerning));
 end;
 
 
@@ -145,6 +151,11 @@ begin
   Result:=Weight;
 end;
 
+function TFresnelWasmFont.GetWidth: TFresnelLength;
+begin
+  Result:=Width;
+end;
+
 function TFresnelWasmFont.TextSize(const aText: string): TFresnelPoint;
 var
   p: TPoint;
@@ -228,6 +239,7 @@ begin
   aFont.Style:=Desc.Style;
   aFont.Variant_:=Desc.Variant_;
   aFont.Weight:=Desc.Weight;
+  aFont.Width:=Desc.Width;
   FFonts.Add(aFont);
   Result:=aFont;
 end;