lilypond-devel
[Top][All Lists]
Advanced

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

Re: guile-2.0 and debian


From: Thomas Morley
Subject: Re: guile-2.0 and debian
Date: Sun, 20 Nov 2016 01:12:59 +0100

Hi,

for now I looked only at a single problem, the meta-data. (Giving me a
royal headache)

2016-11-19 16:05 GMT+01:00 Antonio Ospite <address@hidden>:

> The following change fixes the issue at hand:
>
> ---------------------------------------------------------------------
> diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm
> index a404119..b2b6802 100644
> --- a/scm/framework-ps.scm
> +++ b/scm/framework-ps.scm
> @@ -28,6 +28,9 @@
>               (scm clip-region)
>               (lily))
>
> +(if (guile-v2)
> +  (use-modules(rnrs bytevectors)))
> +
>  (define format ergonomic-simple-format)
>
>  (define framework-ps-module (current-module))
> @@ -518,15 +521,22 @@
>    (define (metadata-encode val)
>      ;; First, call ly:encode-string-for-pdf to encode the string (Latin1 or
>      ;; utf-16be), then escape all parentheses and backslashes
> -    ;; FIXME guile-2.0: use (string->utf16 str 'big) instead
> +    ;; With guile-2.0: use (string->utf16 str 'big) instead
> +    (if (guile-v2)
> +      (ps-quote (utf16->string (string->utf16 val 'big)))

Well, the line above does not make much sense, because val is
effectively returned unchanged, before ps-quote does it's work. See:
(string=? (utf16->string (string->utf16 "ちりぬるを)" 'big)) "ちりぬるを)")
--> #t

> +      (ps-quote (ly:encode-string-for-pdf val))))
>
> -    (ps-quote (ly:encode-string-for-pdf val)))
>    (define (metadata-lookup-output overridevar fallbackvar field)
>      (let* ((overrideval (ly:modules-lookup (list header) overridevar))
>             (fallbackval (ly:modules-lookup (list header) fallbackvar))
>             (val (if overrideval overrideval fallbackval)))
>        (if val
> -          (format port "/~a (~a)\n" field (metadata-encode (markup->string 
> val (list header)))))))
> +        (begin
> +          (format port "/~a (" field)
> +          (set-port-encoding! port "UTF-16")
> +          (format port "~a" (metadata-encode (markup->string val (list 
> header))))
> +          (set-port-encoding! port "ISO-8859-1")
> +          (format port ")\n")))))
>
>    (if (module? header)
>        (begin
> ---------------------------------------------------------------------
>
> This is rather ugly, but encoding only the actual _value_ of the field
> in UTF-16 allows to have exactly the same output as with guile-1.8.

Well, this example gives a gs-error again:

\header { title = "ちりぬるを)" } \markup \null

> The issue is about a file (the postscript file) with a mixed encoding
> (Latin1 and UTF-16) while the file port only has one encoding.
>
> AFAICS in guile-2.0 the difference between characters and bytes is taken
> very seriously.
>
> I'll try to set %default-port-conversion-strategy to 'error and see if
> some other issue shows up.  Where is the earliest point I can set that?

I tried different settings at different places to no avail. So
currently I don't know.


Cheers,
  Harm



reply via email to

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