From: Hans Hagen <pragma@wxs.nl>
Subject: Re: Still have no idea about how to specify fonts in JavaScript fields.
Date: Wed, 22 Nov 2006 15:03:14 +0100 [thread overview]
Message-ID: <456458A2.9040104@wxs.nl> (raw)
In-Reply-To: <769ba7780611220414m4ff61678rf3050912f086a8d9@mail.gmail.com>
Zhichu Chen wrote:
> Hello everyone,
>
> Thanks for suggesting some great documents last time. But after
> looking up in AcroJS Guide, and PDF Reference , etc., I still don't
> know how can I use special fonts in a JavaScript field.
>
>
> My JS code is:
> ------------------------------------------------------------------------------------------
> function start_clock()
> { var thetime=new Date();
> var nhours=thetime.getHours();
> var nmins=thetime.getMinutes();
> var nsecn=thetime.getSeconds();
> if (nhours<0) nhours="0"+nhours;
> if (nsecn<10) nsecn="0"+nsecn;
> if (nmins<10) nmins="0"+nmins;
> font.Digital = font.CourBI ;
> vv = this.getField("time.clock") ;
> if (vv) { vv.value = nhours+":"+nmins+":"+nsecn;
> vv.readonly = true ;
> vv.textColor = color.red ;
> vv.textFont = font.Digital ; // font.TimesBI Cour HelvB Symbol ZapfD
> this.dirty = false }}
>
> timeout=app.setInterval('start_clock()',1000);
> ------------------------------------------------------------------------------------------
>
> I guess there are already some definitions about ``font.CourBI'' but
> where can I find the original code of the definition which I can
> imitate it to create a new font.
>
\startJScode{oeps}
var f = this.getField("TestField") ;
if (f) {
if (f.textFont == "Times-Roman") {
f.textFont = "LMRoman12-Regular";
} else {
f.textFont = "Times-Roman";
}
}
\stopJScode
\setupinteraction[state=start]
\pdfcompresslevel=0
\starttext
\definefield[TestField][text] [TestGroup][][some example text]
\definefield[FontField][check][FontGroup][yes,no][no]
\definesymbol[yes][\strut YES]
\definesymbol[no] [\strut NO]
\setupfield[TestGroup][none][width=10cm]
\setupfield[FontGroup][none][width=3cm,height=2cm,clickin=JS(oeps)]
\field[TestField]
\field[FontField]
abcdefghijklmnopqrstuvwxyz
\stoptext
The problem is that a subsetted font has no known name (prefix is
random); however, when embedded full it does not work either ("Courier"
does work).
Maybe there is special trickery needed to let acrobat know what fonts
can be used. We may as well need some new pdftex code for this.
I cc to Hartmut who is the pdftex teams weird-font-issues wizzard.
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
next prev parent reply other threads:[~2006-11-22 14:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-22 12:14 Zhichu Chen
2006-11-22 14:03 ` Hans Hagen [this message]
2006-11-23 2:46 ` Zhichu Chen
2006-11-23 11:42 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=456458A2.9040104@wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).