tpipro, handle px font units

git-svn-id: trunk@13902 -
This commit is contained in:
jesus 2008-01-28 20:40:23 +00:00
parent feff55eb39
commit 6c3ee3bbc6

View File

@ -769,6 +769,7 @@ type
{$IFDEF IP_LAZARUS} {$IFDEF IP_LAZARUS}
FCSS: TCSSProps; FCSS: TCSSProps;
FElementName: String; FElementName: String;
FCSSPropsLoaded: boolean;
{$ENDIF} {$ENDIF}
FStyle: string; FStyle: string;
FClassId: string; FClassId: string;
@ -4308,7 +4309,7 @@ var
{$ENDIF} {$ENDIF}
begin begin
{$IFDEF IP_LAZARUS} {$IFDEF IP_LAZARUS}
if Self.InheritsFrom(TIpHtmlNodeCore) then if Self.InheritsFrom(TIpHtmlNodeCore)then
TIpHtmlNodeCore(Self).LoadCSSProps(Owner, Elem, RenderProps); TIpHtmlNodeCore(Self).LoadCSSProps(Owner, Elem, RenderProps);
{$ENDIF} {$ENDIF}
for i := 0 to Pred(FChildren.Count) do for i := 0 to Pred(FChildren.Count) do
@ -7613,10 +7614,10 @@ begin
if not TIpHtmlNodeHtml(Parent).HasBodyNode then if not TIpHtmlNodeHtml(Parent).HasBodyNode then
{ No. Create a body node under FHtml. } { No. Create a body node under FHtml. }
with TIpHtmlNodeHtml(Parent) do begin with TIpHtmlNodeHtml(Parent) do begin
{$IFDEF IP_LAZARUS} with TIpHtmlNodeBODY.Create(Parent) do
with {$IFDEF IP_LAZARUS}
{$ENDIF} LoadCSSProps(Owner, Element, nil)
TIpHtmlNodeBODY.Create(Parent){$IFDEF IP_LAZARUS} do LoadCSSProps(Owner, Element, nil){$ENDIF}; {$ENDIF};
{ Make each of FHtml's current children the children of the { Make each of FHtml's current children the children of the
Body node. } Body node. }
@ -14585,7 +14586,7 @@ end;
{ TIpHtmlNodeCore } { TIpHtmlNodeCore }
procedure TIpHtmlNodeCore.ParseBaseProps; procedure TIpHtmlNodeCore.ParseBaseProps(Owner : TIpHtml);
{$IFDEF IP_LAZARUS} {$IFDEF IP_LAZARUS}
var var
Commands: TStringList; Commands: TStringList;
@ -14616,6 +14617,12 @@ var
begin begin
if Owner.CSS = nil then if Owner.CSS = nil then
exit; exit;
{
WriteLn('FCSSPropsLoaded=',TIpHtmlNodeCore(Self).FCSSPropsLoaded);
if FCSSPropsLoaded then
exit;
FCSSPropsLoaded:=True;
}
TmpElement := Element; TmpElement := Element;
if Element = nil then if Element = nil then
begin begin
@ -14760,6 +14767,15 @@ begin
result := round(P); result := round(P);
exit; exit;
end; end;
// check px
P:=GetFSize('px');
if P>0 then begin
// calculate points based on screen resolution :(
// at 96dpi CSS21 recommneds 1px=0.26 mm
// TODO: use screen resolution, check printing!
Result := Round(P*0.7370241)
end;
//todo: em, ex are supposed to be based on the computed pixel size of //todo: em, ex are supposed to be based on the computed pixel size of
// parent node, tpipro has no provision for this.... // parent node, tpipro has no provision for this....