[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The right way to use svg?

From: Zhiwei Chen
Subject: The right way to use svg?
Date: Thu, 09 Sep 2021 20:33:01 +0800

#+begin_src elisp
(require 'svg)

(let* ((text "Hello, world")
       (w (* (length text) (window-font-width)))
       (h (window-font-height))
       (svg (svg-create w h)))
  (svg-rectangle svg 0 0 w h :stroke "black" :fill "none")
  (svg-text svg text
            :x           0
            :y           (- h 4) ;; Why 4 here?
            :fill        "black")
  (insert-image (svg-image svg :scale 1 :ascent 'center)))

PNG image

My question is why it uses 4 rather than other number?

#+begin_src elisp
(list (window-font-width)
;; => (10 21)

on my machine with 1920x1080 screen resolution.

Zhiwei Chen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]