[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Wrong letter in title
From: |
Thomas Morley |
Subject: |
Re: Wrong letter in title |
Date: |
Mon, 1 Oct 2018 21:26:50 +0200 |
Am Mo., 1. Okt. 2018 um 12:08 Uhr schrieb David Kastrup <address@hidden>:
>
> Thomas Morley <address@hidden> writes:
>
> [...]
>
> >> > ;;
> >> > (ps-quote
> >> > (if guile-v2
> >> > (let* ((utf16be-bom #vu8(#xFE #xFF)))
> >> > (string-append (bytevector->string utf16be-bom "ISO-8859-1")
> >> > (bytevector->string (string->utf16 val
> >> > 'big) "ISO-8859-1")))
> >> > (ly:encode-string-for-pdf val))))
> >> >
> >> > ...)
> >> >
> >> >
> >> > Though, this does not work, because guile-1.8 would issue an error
> >> > about the unknown syntax.
> >>
> >> You can always write something like #vu8(#xFE #xFF) as a function call
> >> rather than as "read syntax".
> >
> > Don't understand. Could you give a code-example?
>
> (u8-list->bytevector '(#xFE #xFF))
Works.
Many thanks!
For the record here the code working with guile-1.8 and guile-2.2.4:
(if (guile-v2)
(use-modules
(ice-9 iconv)
(rnrs bytevectors)))
;;; Create DOCINFO pdfmark containing metadata
;;; header fields with pdf prefix override those without the prefix
(define (handle-metadata header port)
(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
;;
;; NOTE: with guile-2.0+ ly:encode-string-for-pdf is not really needed and
;; could be replaced.
;; For guile-2.2.+ this is a 'must do'
;;
(ps-quote
(if (guile-v2)
(let* (;(utf16be-bom #vu8(#xFE #xFF))
(utf16be-bom (u8-list->bytevector '(#xFE #xFF)))
)
(string-append (bytevector->string utf16be-bom "ISO-8859-1")
(bytevector->string (string->utf16 val
'big) "ISO-8859-1")))
(ly:encode-string-for-pdf val))))
...)
>
> >> > Any chance to create something which will work in guilev1 and guilev2?
> >>
> >> I think the sane perspective would be fixing the problem where it
> >> appears rather than at some later point of time.
> >
> > Agreed.
> > Though, to fix ly:encode-string-for-pdf, some C++-work is requiered,
> > which is beyond my capabilities.
>
> Sure, but the 2.0/2.2 differences will have more pressing consequences
> elsewhere. Document metadata is not the highest priority and may even
> "happen" to be fixed as a side effect of other fixes.
We already know the problems with guile-2.0.x.
With guile-2._2_.x (currently I use 2.2.4) the list gets more entries:
- ly:protects doesn't work any more
- message/warnings about missing (ice-9 threads)
- not working special characters in file-names. (Not sure whether it's
already a problem with guile-2.0.x)
- meta-data with special characters
I've already tried some experimental fixes for the first three problems.
See attachment to
http://lists.gnu.org/archive/html/bug-lilypond/2018-06/msg00011.html
patch 13-15
The code above is at least a work around for the last problem.
Are there other known problems new with guile-2.2.x (not yet known
with guile-2.0.x)?
Thanks,
Harm
-