Groups | Search | Server Info | Login | Register
Groups > comp.text.pdf > #2607
| From | Peter Flynn <peter@silmaril.ie> |
|---|---|
| Newsgroups | comp.text.pdf |
| Subject | Re: How can I define the background color of a character ? |
| Date | 2025-02-19 12:51 +0000 |
| Organization | Usenet Labs Bozon Detector Facility |
| Message-ID | <m1m2dkF8m4vU1@mid.individual.net> (permalink) |
| References | <vp2hh7$1q7t6$1@dont-email.me> <vp32et$1tfli$1@dont-email.me> <vp36hv$1uaqf$1@dont-email.me> |
On 18/02/2025 23:53, wolfgang bauer (D) wrote:
> 18.02.25 , 23:43 , Herbert Kleebauer:
>
>> On 18.02.2025 18:54, wolfgang bauer (D) wrote:
>>
>>> I want to write a program, that creates a pdf-file. It works. But
>>> I need to define not only the foreground-color of characters but
>>> also the background color.
[...]
> It works. Thank you for the answer. But it is not exactly, what I
> meant. I want to define the background color of every single
> character. I can try, what you suggested, to draw an rectangle in
> the wanted color and write then the character over it. But I would
> prefer a simpler solution. And my problem is: How can I calculate in
> realtime the dimensions of that rectangle ? I don't want to have to
> determine the values by experimenting. I'm currently doing this as an
> "interim solution".
Much easier to use LaTeX, then you have proper control over the size and
shape and the colours, and it knows the bounding-box of every character
(and you could also make it set each character in a calculated size of
box): see the PDF at https://latex.silmaril.ie/col.pdf
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Verdana}
\usepackage[svgnames]{xcolor}
\newcommand{\bgc}[3]{{\colorbox{#1}{\textcolor{#2}{#3}}}}
\begin{document}
\Huge\fboxsep0pt\fboxrule0pt
\bgc{Red}{Green}{H}%
\bgc{Orange}{Green}{e}%
\bgc{Yellow}{Green}{l}%
\bgc{Green}{Green}{l}%
\bgc{Blue}{Green}{o}%
\
\bgc{Indigo}{Blue}{W}%
\bgc{Violet}{Blue}{o}%
\bgc{CornflowerBlue}{Blue}{r}%
\bgc{PaleGreen}{Blue}{l}%
\bgc{Pink}{Blue}{d}
\fboxsep2pt
\bgc{Red}{Pink}{H}%
\bgc{Orange}{Pink}{e}%
\bgc{Yellow}{Pink}{l}%
\bgc{Green}{Pink}{l}%
\bgc{Blue}{Pink}{o}%
\
\bgc{Indigo}{Grey}{W}%
\bgc{Violet}{Grey}{o}%
\bgc{CornflowerBlue}{Grey}{r}%
\bgc{PaleGreen}{Grey}{l}%
\bgc{Pink}{Grey}{d}
\end{document}
Peter
Back to comp.text.pdf | Previous | Next — Previous in thread | Next in thread | Find similar
How can I define the background color of a character ? "wolfgang bauer (D)" <schutz@gmx.de> - 2025-02-18 18:54 +0100
Re: How can I define the background color of a character ? Herbert Kleebauer <klee@unibwm.de> - 2025-02-18 23:43 +0100
Re: How can I define the background color of a character ? "wolfgang bauer (D)" <schutz@gmx.de> - 2025-02-19 00:53 +0100
Re: How can I define the background color of a character ? Herbert Kleebauer <klee@unibwm.de> - 2025-02-19 01:33 +0100
Re: How can I define the background color of a character ? Peter Flynn <peter@silmaril.ie> - 2025-02-19 12:51 +0000
Thanks (was: Re: How can I define the background color of a character ?) "wolfgang bauer (D)" <schutz@gmx.de> - 2025-02-19 20:30 +0100
csiph-web