Skip to content

Commit

Permalink
use fedora-32 to have GLIBC_2.31
Browse files Browse the repository at this point in the history
AppImage/appimage.github.io#3166

GLIBC @ Ubuntu 20.04.6 LTS (Focal Fossa)
https://launchpad.net/ubuntu/focal/+source/glibc

fix font stretching problem on old fontconfig
  • Loading branch information
VitoVan committed Jun 19, 2023
1 parent 07a1b4e commit 890052a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/calm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- name: Build for Linux
run: |
docker run --env CI=true -v $PWD:/calm -w /calm fedora:34 bash build/build.sh
docker run --env CI=true -v $PWD:/calm -w /calm fedora:32 bash build/build.sh
ls -lah .
- name: Build for Web
Expand Down
3 changes: 2 additions & 1 deletion src/calm.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

#-jscl
(defun calm-quit ()
(sdl2-mixer:close-audio)
(when *calm-state-audio-open*
(sdl2-mixer:close-audio))
;; on Linux & Windows, uiop:quit will hang a while
;; don't know why, fix it recklessly.
(if (uiop:featurep :darwin)
Expand Down
40 changes: 31 additions & 9 deletions src/config.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,40 @@
;; let pango use fontconfig to get cross-platform font loading support
(setf (uiop:getenv "PANGOCAIRO_BACKEND") "fontconfig")

;; set fontconfig config dir
;;
;; set fontconfig config
;;
(setf (uiop:getenv "FONTCONFIG_PATH") (uiop:native-namestring (merge-pathnames "fonts/" *calm-env-app-dir*)))
(setf (uiop:getenv "FONTCONFIG_FILE") (uiop:native-namestring (merge-pathnames "fonts/fonts.conf" *calm-env-app-dir*)))

(format t "fontpath: ~A~%" (uiop:native-namestring (merge-pathnames "fonts/" *calm-env-app-dir*)))
(format t "fontfile: ~A~%" (uiop:native-namestring (merge-pathnames "fonts/fonts.conf" *calm-env-app-dir*)))
(let ((app-fonts-conf (merge-pathnames "fonts/fonts.conf" *calm-env-app-dir*))
(calm-fonts-conf (merge-pathnames "s/usr/all/fonts.conf" *calm-env-calm-home*)))
;;
;; this is only needed by fontconfig @ fedora-32:
;; https://bodhi.fedoraproject.org/updates/?search=fontconfig&releases=F32
;; when a non-exist fonts.conf was set, something weird will happen:
;; like text was stretched
;;
;; why using granny's fedora?
;; because we want to lower the glibc dependency
;; https://github.com/AppImage/appimage.github.io/pull/3166
;; Ubuntu 20.04 LTS with GLIBC_2.31 won't be died till 2030, so...
;; https://wiki.ubuntu.com/Releases
(if (probe-file app-fonts-conf)
;; if there exists a fonts.conf inside app dir, use it
(setf (uiop:getenv "FONTCONFIG_FILE") (uiop:native-namestring app-fonts-conf))
;; if not, use CALM default (this won't be available in distribution mode, but anyway...)
(setf (uiop:getenv "FONTCONFIG_FILE") (uiop:native-namestring calm-fonts-conf)))

(format t "fontpath: ~A~%" (uiop:getenv "FONTCONFIG_PATH"))
(format t "fontfile: ~A~%" (uiop:getenv "FONTCONFIG_FILE"))

;; https://www.freedesktop.org/software/fontconfig/fontconfig-user.html#DEBUG
;; (setf (uiop:getenv "FC_DEBUG") "1024")

;; reinit fc, if there exists fonts.conf
(when (or (probe-file app-fonts-conf) (probe-file calm-fonts-conf))
(fontconfig:fc-init-reinitialize)))

;; https://www.freedesktop.org/software/fontconfig/fontconfig-user.html#DEBUG
;; (setf (uiop:getenv "FC_DEBUG") "1024")

;; init fc
(fontconfig:fc-init-reinitialize)
)

#+jscl
Expand Down

0 comments on commit 890052a

Please sign in to comment.