delphicef4delphi

CEF4Delphi Application font size decreased after CEF is loaded


I have a very strange behavior. After CEF libraries are loaded, all the fonts in WHOLE application are decreased. It happened after I have migrated to the newest version of CEF (117.2.5) from version 96.

It is a Windows 32 bit application written and compiled with Delphi 2007. The application is complex, it has a lot of dynamically loaded libraries (BPLs).

The strangest thing is that this happens only on some machines (Win10 Enterprise N and Win10 Professional 64 bit). None of them has Delphi IDE installed, so I can't debug it.

The CEF is loaded with code, run with subprocesses:

  sciezkaRoot := IncludeTrailingPathDelimiter(GetRootPath());
  sciezkaBinariow := sciezkaRoot + CHROMIUM_FOLDER_BINARIOW;
  sciezkaProcesu := sciezkaRoot + CHROMIUM_FOLDER_KOMUNIKACJA_MARKETINGOWA + CHROMIUM_PROCES_EXE;
  try
    if not FileExists(sciezkaProcesu) then
      raise Exception.Create('Brak wymaganego pliku w lokalizacji:' + #13 + sciezkaProcesu);
    uCEFApplication.GlobalCEFApp := TCefApplication.Create();
    with uCEFApplication.GlobalCEFApp do
    begin
      ShowMessageDlg := False;
      MissingBinariesException := True;
      BackgroundColor := ColorToTCefColor(clBtnFace);
      Cache := fKatalogCache;
      EnablePrintPreview := False;
      EnableGPU := False;
      FrameworkDirPath := sciezkaBinariow;
      ResourcesDirPath := sciezkaBinariow;
      LocalesDirPath := sciezkaBinariow + 'locales';
      LocalesRequired := 'pl';
      Locale := 'pl';
      SetCurrentDir := True;
      BrowserSubprocessPath := sciezkaProcesu;
      Result := StartMainProcess();
    end;
  except
    on e: Exception do
    begin
      FreeAndNil(uCEFApplication.GlobalCEFApp);
      Result := False;
    end;
  end;

It does not matter if I load any web page or not.

Any ideas what is happening and why?


Solution

  • CEF had some issues about this in recent versions because Chromium sets the Windows process DPI awareness if unset.

    Read these issues for more information: