0

I've just came across a very very disturbing issue. I work with another programer and we share the code thru SVN. There's this project we're working on that I had started first. I've modelled all the layouts and did all the forms already, and some code also. So far so good. But the issue is, whenever my peer gets the files from the server, when Delphi loads the project, it messes up all FontSizes of all VCL components, along with all heights and widths.

Just to ilustrate, this is what mine looks like

Mine

And this is what his looks like

His

It's the same files, we copied directly from the SVN server, we tried getting the files directly from my computer, but to no success. We have a spare computer from an employee that left the company, and on that PC, it works! All properties get messed up when he loads my project files (double clicking the .dpr and .dproj)

We all use Windows 8 64bit and Rad Studio XE2. Any help would be appreciated.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • This is the classic issue of DPI which has been covered many times here on Stack Overflow. – Jerry Dodge Aug 06 '15 at 20:38
  • 1
    possible duplicate of [How can I make Windows 8.1 aware that my Delphi application wants to support Per Monitor DPI?](http://stackoverflow.com/questions/26852150/how-can-i-make-windows-8-1-aware-that-my-delphi-application-wants-to-support-per) – Jerry Dodge Aug 06 '15 at 20:40
  • 2
    All devs need to use the same dpi. I recommend all using 96 dpi. – David Heffernan Aug 06 '15 at 21:06
  • TFont stores the font size as a negative height. This height is converted to a size by dividing by the DPI and then multiplying by 72 which is the default windows font point size. That means that a size of 9 would be a height of -12 on a 96 DPI setup but a height of -18 on for a developer that has a 144 DPI setup. In your case, you probably have a high DPI setup and he has a 96 dpi setup. – Graymatter Aug 06 '15 at 22:15
  • 2
    Just for the record, this has nothing to do with *Delphi automatically changing* anything. This is strictly an operating system issue. – Ken White Aug 06 '15 at 23:23
  • @KenWhite In a way it is Delphi automatically changing the values. The developer sees a size property which Delphi converts into a height when it streams to the DFM. It's Delphi code that does the conversion to and from the height. – Graymatter Aug 06 '15 at 23:56
  • @Graymatter: It's doing so just like any other application would, in response to what the OS is instructing. It's not a Delphi issue, any more than it would be an issue with the language if you were running any other executable you weren't developing which behaved the same way. The only involvement Delphi has is that the IDE is the application that's demonstrating the behavior. – Ken White Aug 07 '15 at 00:00
  • @KenWhite What I mean is that Delphi is the one that is changing the size property or at least giving the impression that it's changing. If you load the form into the IDE on a high DPI machine then it will give you one value for the size of the font. If you load it on another machine with a different DPI then it will display a different size. The font height remains the same. The automatic conversion of the size is not always ideal as developers often use this figure to calculate border sizes, etc. I understand that the OS does exactly the same thing but in this case it's Delphi doing it. – Graymatter Aug 07 '15 at 00:07
  • @Graymatter: This is something totally out of the control of the IDE. It (properly) calculates display settings based on the system values. The only realistic solution for this is for developers to standardize on a set of display settings (to enable development to proceed without these sorts of issues), and then design your application to correctly handle display differences *at runtime*, and test at various display settings. – Ken White Aug 07 '15 at 01:58
  • @Ken It's absolutely a Delphi issue. The OS does no scaling. – David Heffernan Aug 07 '15 at 04:22
  • http://stackoverflow.com/questions/31835502/is-it-safe-to-use-delphi-visual-form-designer-in-high-dpi – David Heffernan Aug 07 '15 at 04:54
  • 1
    Oddly, I've seen some Microsoft software itself scale the same way across different monitors with different DPI... the same way that Delphi does. For example, the installation for SQL Server 2008 R2. – Jerry Dodge Aug 07 '15 at 05:46
  • We have the almost exact same computers, the only difference between his and mine is that I have a core i3 intel processor and he has a core i5 processor, but both of us have Dell Inspiron One , so I'm assuming that we have the same configuration in regards to DPI, but I'll investigate further. Thanks! – Raoni Medinilha Aug 07 '15 at 11:27
  • @David: Read my last comment again. *It [the IDE] (properly) calculates display settings based on the system values* at the time the form was designed. The OS provides that information. – Ken White Aug 07 '15 at 12:26
  • @Ken Yes. It gets it right too. There's probably a combination of VCL design issues and errors made by the devs in handling scaling. VCL design issue is exposing integer dimensions to devs. – David Heffernan Aug 07 '15 at 12:41
  • You should be showing us screenshots of *either* run-time *or* design-time, but not one of each. Run-time and design-time may differ even on the same computer. – Jerry Dodge Aug 07 '15 at 17:24

0 Answers0