ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Sietse Brouwer <sbbrouwer@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: square in Cambria font
Date: Wed, 1 May 2013 00:17:37 +0200	[thread overview]
Message-ID: <CAF=dkzz4hYzEtzN-ZxjG6-9c_sMYaFYS_mgGpLDqAfWp-G_V4Q@mail.gmail.com> (raw)
In-Reply-To: <CAF=dkzx51WZxR5TYNAujJzvLd09En9rEzp=4F7Ueoyf2_RBR_g@mail.gmail.com>

Hello Hans,

The bad news: I think it's the font. The good news: here comes
MetaPost to the rescue!

I don't have Cambria, so I plucked a cambria.ttf file off the Internet
somewhere, which contains both Cambria and Cambria Math. I don't know
whether you have the same file/version, so YMMV, but it does exhibit
the problem you describe.

According to the lovely and free FontForge,
* the WHITE SQUARE glyph (U+25A1) is 1060 units high
* the SQUARED PLUS glyph (U+229E) is 1630 units high (of which 230
below the baseline).

This is in Cambria Math — Cambria does does not have either of these
glyphs. I suspect the square size is a design decision: that the
designers decided they wanted the white square to match the letters
rather than the 'squared *' operators.

Anyway, here's a very close MetaPost approximation of the 'squared
plus' square, made by looking in with FontForge and copying the glyph
dimensions. (And then tweaking them because some things still didn't
look right; didn't manage to fix everything, alas.) It scales with the
font size.

Cheers,
Sietse

\setuppapersize[A7][A7]
\setuppagenumber[state=stop]
\setupbodyfont[cambria,40pt]

\showframe
\showgrid

\startuseMPgraphic{square}
    numeric u, strokewd, strokeht, sqwd, sqht;
    u        := BodyFontSize / 2083;
    strokewd := 128u;
    strokeht := 123u;
    sqwd     := 1506u;
    sqht     := 1533u;
    offset   := 200u;
    pickup pensquare xscaled strokewd yscaled strokeht;
    draw unitsquare xscaled sqwd yscaled sqht;

    setbounds currentpicture to
        boundingbox currentpicture
        leftenlarged offset rightenlarged offset;
\stopuseMPgraphic

\def\mysquare{%
    \lower \dimexpr \bodyfontsize / 2083 * 234
\relax\hbox{\useMPgraphic{square}}%
}

%%%% try it out %%%%

\starttext

$\square+\mysquare\boxplus$ \crlf
$\mysquare\boxplus$

\page[yes]

$+ \ruledhbox{\boxplus}$  \crlf
$+ \ruledhbox{\mysquare}$ \crlf
$\ruledhbox{\boxplus}$  \crlf
$\ruledhbox{\mysquare}$

\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2013-04-30 22:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-30 11:25 Meer, H. van der
     [not found] ` <CAF=dkzx51WZxR5TYNAujJzvLd09En9rEzp=4F7Ueoyf2_RBR_g@mail.gmail.com>
2013-04-30 22:17   ` Sietse Brouwer [this message]
2013-05-01  8:05     ` Meer, H. van der
2013-05-01 14:51       ` Sietse Brouwer

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='CAF=dkzz4hYzEtzN-ZxjG6-9c_sMYaFYS_mgGpLDqAfWp-G_V4Q@mail.gmail.com' \
    --to=sbbrouwer@gmail.com \
    --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).