Jump to content

Unexpected size of font (Tahoma size 16)


likemike

Recommended Posts

Hello!

I'm using the font Tahoma in different sizes (depending on the resolution of the frontend device).

In Delphi it looks like this:

Snap_002_.jpg.9627b69471ce7f4993d7e916c63318f3.jpg

But on all devices it looks like this:

Snap_001_.jpg.be83c51214e9d2653d2e6aafd406e254.jpg 

The font with size 16 is much too small in comparison to the other font-sizes.

Any idea, what is reponsible for that behaviar and how to fix it?

Best regards

Mike

Link to comment
Share on other sites

14 minutes ago, likemike said:

The font with size 16 is much too small in comparison to the other font-sizes.

Any idea, what is reponsible for that behaviar and how to fix it?

Hello,

How can we reproduce this issue? Please provide more information.

Link to comment
Share on other sites

That's quite easy. You can use any of your demos and add 5 labels with font sizes 20, 19,18,17,16.
As an example I add the Form-Controls-Demo which is modified (5 labels are added).FormControls.rar

I've tried it with different devices (Tablet, Desktop...) and different browsers (Chrome, Edge, Safari).

Link to comment
Share on other sites

13 hours ago, likemike said:

That's quite easy. You can use any of your demos and add 5 labels with font sizes 20, 19,18,17,16.
As an example I add the Form-Controls-Demo which is modified (5 labels are added).FormControls.rar

I've tried it with different devices (Tablet, Desktop...) and different browsers (Chrome, Edge, Safari).

Can you try this approach for now?:

UniMainModule -> OnNewComponent event

procedure TUniMainModule.UniGUIMainModuleNewComponent(AComponent: TComponent);
begin
  if (AComponent is TUnimLabel) then
    (AComponent as TUnimLabel).JSInterface.JSConfig('style', [(AComponent as TUnimLabel).Font.ToString(True, False, True)]);
end;

 

Link to comment
Share on other sites

This seems to work - but I have the same problem with TUnimMemo, so I've tried the same code:

if (AComponent is TUnimMemo) then (AComponent as TUnimMemo).JSInterface.JSConfig('style', [(AComponent as TUnimMemo).Font.ToString(True, False, True)]);

But this won't work. Why? 

Link to comment
Share on other sites

15 hours ago, likemike said:

but I have the same problem with TUnimMemo

procedure TUniMainModule.UniGUIMainModuleNewComponent(AComponent: TComponent);
begin
  if (AComponent is TUnimLabel) then
    (AComponent as TUnimLabel).JSInterface.JSConfig('style', [(AComponent as TUnimLabel).Font.ToString(True, False, True)])
  else if (AComponent is TUnimMemo) then
    (AComponent as TUnimMemo).JSInterface.JSAddListener('painted', 'function(me){me.inputElement.applyStyles('''+ (AComponent as TUnimMemo).Font.ToString(True, False, True) +'''); me.inputElement.setStyle("line-height", me.inputElement.getStyle("font-size"));}');
end;

 

Link to comment
Share on other sites

×
×
  • Create New...