Cross compiling and fonts lazarus / 10-Designer ---------------------------------------------------------------------- patyi · 2007-12-15 09:15 Hi ! I made a small project on Win32, port it to Linux (Ubuntu 7.10), made some modifications on Linux, dhen go back to Win32. It is almost fine, but I see big difference visualy on fonts. Wen I corrected this on Win, Linux lock ugly, and viceversa ... What is the metodology or what is the best practice to do cross platform programs, without changing font settings for actual platform ? It is posible to set fonts universaly ? Thanks. ---------------------------------------------------------------------- antonio · 2007-12-15 10:15 You can set fonts for each widgetset using compiler directives. For example: Code: [Select] {$ifdef Windows} // font for Windows {$else} // font for Linux {$endif} { If I can remeber correctly. ---------------------------------------------------------------------- Dr.Theopolis · 2007-12-15 16:57 I have the same problem as patyi.  :? Antonio, are you saying that every parent control in a project needs to have its font set at runtime using the method above? And unless there are fonts that are pretty much exact size on both platforms, one might also have to adjust left and top properties for labels and such. So what fonts are good to use as default fonts on Windows & Linux that are the same size? ---------------------------------------------------------------------- antonio · 2007-12-15 17:57 No, I am not saying that. It seems that patyi knows what fonts he want to have on each OS, so I say it is possible to set for an application a different font for each OS it will be compiled to. Choosing a font to an application is up to developer, even to know what font is visually the same is a subjective problem. ---------------------------------------------------------------------- Phil · 2007-12-15 20:01 Quote from: "antonio"Choosing a font to an application is up to developer, even to know what font is visually the same is a subjective problem. In general, forms using commonly-used TrueType fonts like Arial, Times New Roman and Courier can be used interchangeably with win32 and carbon widgetsets since these fonts are included with both Windows and OS X. The problem is with the gtk fonts. It might be worth creating a little console converter app that maps the TrueType fonts to and from, say, the gtk helvetica, times and courier (adobe) fonts. Then just run this converter on your forms in a script file before compiling. Thanks. -Phil ---------------------------------------------------------------------- antonio · 2007-12-16 01:00 "Write once and compile everywhere." ---------------------------------------------------------------------- duncanparsons · 2007-12-17 09:23 ..thing is, it does compile - this isn't really an FPC or a Laz problem, it's a platform problem! DSP ---------------------------------------------------------------------- Marc · 2007-12-17 10:37 lazarus only helps in generating executables. External dependencies like fonts you have to provide yourself. ---------------------------------------------------------------------- patyi · 2007-12-17 11:11 I made some experiment, this example could solves the font problem nearly satisfactorily : procedure TFPrijava.FormCreate(Sender: TObject); var   fn : string;   fs, i : integer;   co : TComponent; begin   {$IFDEF WINDOWS}     fn := 'Arial';     fs := 9;   {$ELSE}     fn := 'Sans';     fs := 8;   {$ENDIF}   for i := 0 to ComponentCount-1 do begin     co := Components;     if co is TControl then begin       TControl(co).Font.Name := fn;       TControl(co).Font.Size := fs;     // global settings om form       if (co is TBitBtn) or          (co is TEdit) or          (co is TComboBox) then         TControl(co).Font.Style:= [fsBold];  // special if neaded     end;   end;     It is very nice but, Lazarus has another problem: position and size of components at design time is not correct specially when I use right alignment for example in Label component. Vertical size of edit box, combo box is also incorrect. I know that is platform problem, it is differences between GTK2 and Windows widgets. Because of this almost is impossible to do cross platform development in way I want. Better way is to chose the primary platform where is the development and modifications was made, an second platform is for only recompile and testing (eventually correct the visual problems). Moving source code back to primary platform may take big problems for whole project in esthetic's meaner ! :shock: Sorry for my English ! I hope the world understand what i mean ... :lol: ---------------------------------------------------------------------- antonio · 2007-12-17 13:36 Quote from: "patyi"position and size of components at design time is not correct specially when I use right alignment for example in Label component. Vertical size of edit box, combo box is also incorrect. You could report a bug. ---------------------------------------------------------------------- Dr.Theopolis · 2007-12-20 22:16 If anyone has made a nice multi-platform app and you came up with a good way to deal with differing font sizes between platforms, how did you do it? Thanks. ---------------------------------------------------------------------- antonio · 2007-12-20 22:53 Was it not the question? Do you think I did'nt understand the question? ---------------------------------------------------------------------- Dr.Theopolis · 2007-12-21 03:21 Should I ask your permission before I post on this forum? Anyway...I am simply asking for others who have not yet participated in this topic to share a bit about the solutions that worked for them. ---------------------------------------------------------------------- antonio · 2007-12-21 05:38 You are saying I diidn't understand _your_ question. Sorry. ---------------------------------------------------------------------- windy · 2007-12-26 18:48 Hi the way I deal with problem, for between linux and the mac, is when updating /changing code on the linux pc, I then just copy across the .pas files needed that have changed,to the mac pc ( after first setting the needed fonts to look ok on the Mac (and re positioning and resizing the objects on the forms), a one time change only (unless things added or need changing) ...just my 2 cents worth Hope everyone had a good xmas!