Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Please help me with this perl question

0 views
Skip to first unread message

FORREST COPLEY

unread,
Dec 29, 2011, 12:48:43 PM12/29/11
to perl-u...@perl.org
Is it possible to write a perl script to print a completely custom character on a console text terminal?
Say a D rotated 90 degrees or something.
or an A with the innards filled in.
--

Forrest Copley | Senior Technical Support Engineer, Solaris OS Support , Global Systems Support
Email: forrest...@oracle.com
Phone: 303.272.6716
Oracle Global Customer Services

Log, update, and monitor your Service Request online using https://support.oracle.com

Michael Ludwig

unread,
Dec 30, 2011, 2:12:09 PM12/30/11
to perl-u...@perl.org
FORREST COPLEY schrieb am 29.12.2011 um 10:48 (-0700):
> Is it possible to write a perl script to print a completely custom
> character on a console text terminal?
> Say a D rotated 90 degrees or something.
> or an A with the innards filled in.

Here's how to print alpha to omega:

perl -C2 -lwe 'print join q(, ), map chr, 0x391 .. 0x3a9'

Α, Β, Γ, Δ, Ε, Ζ, Η, Θ, Ι, Κ, Λ, Μ, Ν, Ξ, Ο, Π, Ρ, ΢, Σ, Τ, Υ, Φ, Χ, Ψ, Ω

If you know the Unicode codepoints you can certainly print the characters.
For Perl, it's essentially numbers.

Whether your particular character comes out nicely or not depends on
whether the font you're using has the glyph in question.

Next time you might want to spend two seconds or even ten thinking
about a suitable subject line …

--
Michael Ludwig

Karl Williamson

unread,
Dec 30, 2011, 2:47:00 PM12/30/11
to FORREST COPLEY, perl-u...@perl.org
On 12/29/2011 10:48 AM, FORREST COPLEY wrote:
> Is it possible to write a perl script to print a completely custom
> character on a console text terminal?
> Say a D rotated 90 degrees or something.
> or an A with the innards filled in.
> --
>
>

http://search.cpan.org/~bdfoy/Unicode-Tussle-1.03/lib/Unicode/Tussle.pm

contains the Perl script:
leo - uʍopəpᴉsdn sƃuᴉɥʇ əʇᴉɹʍ oʇ ɹəʇlᴉɟ

That's the closest thing I know about

Dean Hoover

unread,
Dec 30, 2011, 3:24:47 PM12/30/11
to perl-u...@perl.org
I don't see how you can do that... you are dependent on the capabilities of the terminal. If its an old school text terminal, you can't just draw arbitrary stuff like a rotated D. That is pretty fancy and even in graphics mode has nothing to do with perl, or do I misunderstand your question?

Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯

unread,
Feb 14, 2012, 5:01:07 AM2/14/12
to perl-u...@perl.org
Yes, it is possible. This is an example:

perl -C -E'say"\x{e8f4}\x{e8f5}"'

Screenshot: <http://i.imgur.com/wivY9.png>

The magic happens not at the Perl level, but at the rendering step.

I first picked two unassigned codepoints. Unicode provides a private
use area for exactly this kind of purpose.

I also took care not to trample over a [registered script]
(http://enwp.org/ConScript_Unicode_Registry). Then I created a
font with two glyphs, `U+E8F4 ROTATED LATIN CAPITAL LETTER D` and
`U+E8F5 LATIN CAPITAL LETTER A WITHOUT COUNTER`, and installed it.
Last, I restarted my terminal application so that the new font gets
picked up, and executed the Perl one-liner from above.
signature.asc
0 new messages