Igo*_*gor 8 fonts wolfram-mathematica mathematica-8
我为我的书使用Constantia字体(随Windows 7一起提供),并希望使用Mathematica中的相同字体为本书准备图形.问题是Constantia默认输出旧式数字.我知道,例如在XeTeX中,可以控制旧式或普通数字是否用于输出.
是否可以控制Mathematica中的数字样式?
我觉得这很难.Constantia可直接在Mathematica中使用:
Style["0123456789", FontFamily -> "Constantia", FontSize -> 100]
Run Code Online (Sandbox Code Playgroud)
但是,字体专门设计为以这种方式平衡.如果您调整大小和使用字母的位置FontSize
和AdjustmentBox
你得到这样的:
shift = {0, 0, 0, -1, -1, -1, 0.0, -1, 0.0, -1} 0.5;
s = 0.65;
sizeScale = {1, 1, 1, s, s, s, s, s, s, s, s};
Row[Table[
AdjustmentBox[
Style[num, FontFamily -> "Constantia",
FontSize -> 100 sizeScale[[num + 1]]],
BoxBaselineShift -> shift[[num + 1]]], {num, 0,
9}]
] // DisplayForm
Run Code Online (Sandbox Code Playgroud)
您会看到移位和缩放的字母具有不同的体重.字体重量可以调整,但只能非常粗略.通常你只有普通和粗体样式.所以你可以尽可能接近:
body = {Plain, Plain, Plain, Bold, Bold, Bold, Bold, Bold, Bold, Bold};
Row[Table[
AdjustmentBox[
Style[num, FontFamily -> "Constantia" ,
FontWeight -> body[[num + 1]],
FontSize -> 100 sizeScale[[num + 1]]],
BoxBaselineShift -> shift[[num + 1]]], {num, 0,
9}]] // DisplayForm
Run Code Online (Sandbox Code Playgroud)
好一点,但仍然很难看.我假设这个字母的全新设计是必要的.也许正常的字母可以在字体表中的某个地方找到?
UPDATE
找到替代号码集.它们位于字体表中的位置8320 - 8329.您应该能够使用字体实用程序切换它们.
Style[FromCharacterCode[Range[8320, 8329]],FontFamily -> "Constantia", FontSize -> 100]
Run Code Online (Sandbox Code Playgroud)
对于蜱虫,有一个解决方法,但需要一些编程。首先,有一个辅助功能。
getDigits[n_Integer] := IntegerDigits[n]
getDigits[0.] := {0}
getDigits[n_Real] :=
With[{rd = RealDigits[n]},
Join[Take[rd[[1]], rd[[2]]], {"."},
Drop[rd[[1]], rd[[2]]] ] /. {".", z___} -> {0, ".", z} /. {a__,
0 ..} -> {a} /. {a__, Repeated[0, {4, 150}], q__} -> {a} /.
{b__, "."} -> {b}]
Attributes[getDigits] = Listable
getDigits[{14.3, 2, 274, 2345.67}]
{{1, 4, ".", 3}, {2}, {2, 7, 4}, {2, 3, 4, 5, ".", 6, 7}}
Run Code Online (Sandbox Code Playgroud)
然后,像这样的函数:
ConstantiaTicks[a_?VectorQ, opts : OptionsPattern[Style]] :=
Transpose@{a,
Style[#, FontFamily -> "Constantia",
Sequence @@ {opts}] & /@ (StringJoin /@
Map[ToString[
Style[Which[IntegerQ[#],
FromCharacterCode[# + 8320], # === ".", "."]]] &,
(getDigits[a]), {2}])}
Run Code Online (Sandbox Code Playgroud)
产生以下结果:
FrameTicks
然后可以在or选项中使用它Ticks
。当然,这确实意味着指定您的刻度,而不是让 Mathematica 自动计算出它们的值。它还意味着采用默认的刻度长度,除非您想要另一个参数来ConstantiaTicks
指定它。
归档时间: |
|
查看次数: |
321 次 |
最近记录: |