Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The "cutting edge" is getting rather dull. -- Andy Purshottam


devel / comp.lang.tcl / Re: Text tag woes

SubjectAuthor
* Text tag woesHelmut Giese
+* Re: Text tag woesRich
|`- Re: Text tag woesRalf Fassel
+- Re: Text tag woesRalf Fassel
`- Re: Text tag woesHelmut Giese

1
Text tag woes

<a5q7ghl3bku6of8jn5tkc4098t0alsd6r5@4ax.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19860&group=comp.lang.tcl#19860

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: hgiese@ratiosoft.com (Helmut Giese)
Newsgroups: comp.lang.tcl
Subject: Text tag woes
Date: Mon, 22 Aug 2022 22:58:45 +0200
Organization: ratiosoft
Lines: 32
Message-ID: <a5q7ghl3bku6of8jn5tkc4098t0alsd6r5@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="d4e3f96958c82d8383d18808e682cd46";
logging-data="2906660"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gYBlPQ9zJbgiiuvpyjCsE"
Cancel-Lock: sha1:h5NkLR7AxUSQJE+pxBfiEtE0fgs=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
 by: Helmut Giese - Mon, 22 Aug 2022 20:58 UTC

Hello out there,
I have big problems with the text widget's tags. Look at this example
----
package require Tk
foreach ch [winfo children .] {destroy $ch}
catch {font delete h1Font}

set t [text .txt -height 10]
pack $t

font create h1Font -family {"Times New Roman" Times serif} -size 20 \
-weight bold -slant roman -underline 0 -overstrike 0

$t insert end "01234567890123456789\n"
$t insert end "An example H1 header\n" h1Font
----
The output tells me (at least on my machine)
- it is still a fixed font
- the size seems to be the original and is certainly not 20 points
- and it is not bold either.

I had this almost working: The output was bold, the size was big and
reacted on manually re-configuring the tag - but then I noticed that
the font was not 'Times' (it was a non-serif font like Arial or
Helvetica - nowhere did I configure this).
So it looks almost as if the text widget has a will of its own: It
used to follow me a bit but today it decided to ignore me completely.

Any advice with which voodoo the text widget can be convinced will be
greatly appreciated.
Oh, this is on Windows 10 (64 bit) and Tcl8.6.10.
Helmut

Re: Text tag woes

<te0r6h$2on2g$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19861&group=comp.lang.tcl#19861

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Text tag woes
Date: Mon, 22 Aug 2022 21:07:30 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <te0r6h$2on2g$1@dont-email.me>
References: <a5q7ghl3bku6of8jn5tkc4098t0alsd6r5@4ax.com>
Injection-Date: Mon, 22 Aug 2022 21:07:30 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="61302d16c992cfd5eab2310d08b6d10a";
logging-data="2907216"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19WDDltTZFflR0nvlc0aZqe"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:LLDtHKCL4wMTztVqAVukRYTH5mU=
 by: Rich - Mon, 22 Aug 2022 21:07 UTC

Helmut Giese <hgiese@ratiosoft.com> wrote:
> Hello out there,
> I have big problems with the text widget's tags. Look at this example
> [snip ... see prior article]
> $t insert end "An example H1 header\n" h1Font
> Any advice with which voodoo the text widget can be convinced will be
> greatly appreciated.

The text widget "insert" command takes pairs of "characters" and "text
tags".

You have a font named h1Font.

You separately have conjured a text tag name "h1Font" into life in the
insert command.

But you've never linked the text's tag named "h1Font" to the separate
font named "h1Font".

Make this change (see the + line below):

font create h1Font -family {"Times New Roman" Times serif} -size 20 \
-weight bold -slant roman -underline 0 -overstrike 0

+ $t tag configure h1Font -font h1Font

$t insert end "01234567890123456789\n"

Re: Text tag woes

<ygamtbv4eka.fsf@akutech.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19863&group=comp.lang.tcl#19863

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: Text tag woes
Date: Tue, 23 Aug 2022 09:14:13 +0200
Lines: 12
Message-ID: <ygamtbv4eka.fsf@akutech.de>
References: <a5q7ghl3bku6of8jn5tkc4098t0alsd6r5@4ax.com>
<te0r6h$2on2g$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net SMXX85YuM61VAZKN4Tb2Ug9cecOCn6oz0TTJgKZPqWqikSamU=
Cancel-Lock: sha1:ksaFXhMmLehGl51/gMSJY9JFnv4= sha1:L5FuYQ2vpU/a9ja0D808I1HLIFc=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)
 by: Ralf Fassel - Tue, 23 Aug 2022 07:14 UTC

* Rich <rich@example.invalid>
| + $t tag configure h1Font -font h1Font
>
| $t insert end "01234567890123456789\n"

I think that last line should be

$t insert end "01234567890123456789\n" h1font

in order to have the tag text font take effect?

R'

Re: Text tag woes

<ygaa67v4e4l.fsf@akutech.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19864&group=comp.lang.tcl#19864

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: Text tag woes
Date: Tue, 23 Aug 2022 09:23:38 +0200
Lines: 32
Message-ID: <ygaa67v4e4l.fsf@akutech.de>
References: <a5q7ghl3bku6of8jn5tkc4098t0alsd6r5@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net +p3EW+lQF5q7D0bj/g5vJQ72bTl86Xfq4NOlIetlAwegBpSnw=
Cancel-Lock: sha1:TY4xqGbZyOJD8pWmiP17pLujvY4= sha1:QRsd1CR+oeEL4hCJJhe6qZ91E0s=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)
 by: Ralf Fassel - Tue, 23 Aug 2022 07:23 UTC

* Helmut Giese <hgiese@ratiosoft.com>
| I have big problems with the text widget's tags.

Rich has already answered the text tag issue, I'd like to point out a
different issue:

| font create h1Font -family {"Times New Roman" Times serif} ...

On Linux, tk 8.6.12 this creates a Helvetica style font.

Only if I use

font create h1Font -family "Times" ...

I get a 'Times' font. Note that the font(n) manpage says:

-family name
[...]
Tk guarantees to support the font families named Courier
(a monospaced “typewriter” font), Times (a serifed
“newspaper” font), and Helvetica (a sans-serif “European”
font).
[...]
The name may also be the name of a native,
platform-specific font family; in that case it will work
as desired on one platform but may not display correctly
on other platforms.

So for better platform interoperability, just use 'Times', not some
Windows-centric form of the font name.

R'

Re: Text tag woes

<apo9gh5o3p3k0s3h2f3ot4bn6a9vkard5b@4ax.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19873&group=comp.lang.tcl#19873

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: hgiese@ratiosoft.com (Helmut Giese)
Newsgroups: comp.lang.tcl
Subject: Re: Text tag woes
Date: Tue, 23 Aug 2022 16:31:07 +0200
Organization: ratiosoft
Lines: 8
Message-ID: <apo9gh5o3p3k0s3h2f3ot4bn6a9vkard5b@4ax.com>
References: <a5q7ghl3bku6of8jn5tkc4098t0alsd6r5@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="18ef17c16ed13b8d17b55a5dcc867e30";
logging-data="3171984"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1xEoXiB8cI3FIrLWNHp1Q"
Cancel-Lock: sha1:XODv/GUtepJbDGXOu2qqDlJn6kc=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
 by: Helmut Giese - Tue, 23 Aug 2022 14:31 UTC

Hello Rich and Ralf,
many thanks to both of you.
2Rich: To not configure the tag with the font was a blunder I only had
in the code snippet I posted not in my real application.
2Ralf: Your tip to only use 'Times' when specifying the font was spot
on: I now have a bold font in 'Times' of the correct size.
Thanks again
Helmut


devel / comp.lang.tcl / Re: Text tag woes

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor