anchor.diff:    gui_form,
     cursorfont,
     gfx_popupwindow,
  -  xatom,      // used for XA_WM_NAME
  -  gfx_utf8utils;
  +  xatom,          // used for XA_WM_NAME
  +  gfx_utf8utils;  // used for GetTextWidth
   
   var
     xapplication: TfpgApplication;
  
positive.code: 
  { TfpgFontResourceImpl }
  
  constructor TfpgFontResourceImpl.Create(const afontdesc: string);
  begin
    FFontData := XftFontOpenName(xapplication.display, xapplication.DefaultScreen, PChar(afontdesc));
  
negative.code: end;
  
  function TfpgFontResourceImpl.GetTextWidth(const txt: string): integer;
  begin
    if length(txt) < 1 then
    begin
      Result := 0;
      Exit;
    end;
    // Xft uses smallint to return text extent information, so we have to
    // check if the text width is small enough to fit into smallint range
    if DoGetTextWidthClassic('W') * Length(txt) < High(smallint) then
      Result := DoGetTextWidthClassic(txt)
    else
      Result := DoGetTextWidthWorkaround(txt);
  end;
  
  { TfpgCanvasImpl }
  