vectorfontslispcommon-lispclisp

Bad magic value in font header: #x0A3B3B3B (expected #x00010000 or #x74727565 or #x74746366) in clisp


I am new to clisp and was trying to write a vecto function radiant-lambda:

(defun radiant-lambda (file)
  (with-canvas (:width 80 :height 80) 
    (let ((font (get-font "times.ttf"))
          (step (/ pi 7)))
      (set-font font 40)
      (translate 45 45)
      (draw-centered-string 0 -10 #(#x3BB))
      (set-rgb-stroke 1 0 0)
      (centered-circle-path 0 0 35)
      (stroke)
      (set-rgba-stroke 0 0 1.0 0.5)
      (set-line-width 4)
      (dotimes (i 14)
        (with-graphics-state 
          (rotate (* i step))
          (move-to 30 0)
          (line-to 40 0)
          (stroke)))
      (save-png file))))

But I got the error

Bad magic value in font header: #x0A3B3B3B (expected #x00010000 or #x74727565 or #x74746366) [Condition of type ZPB-TTF::BAD-MAGIC].

I assumed while calling this function I had used the parameter incorrectly and had asked this question (how to pass a .png file as parameter in clisp function), but apparently "times.ttf" font is the problem according one suggestion there.

Please let me know if how a font should be given here.


Solution

  • It seems that the times.ttf file you are using is not actually a ttf file. Where did you get it from?

    Since the bytes 0x0A3B3B3B translate to a newline followed by three semicola, I suspect that it is a renamed lisp file.