카테고리 없음

[fonts] Mathematica에서 숫자 스타일을 제어 할 수 있습니까?

행복을전해요 2020. 12. 9. 14:57

For ticks, there is a workaround, but it requires a bit of programming. First, there is an auxiliary function.

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}} 
                

Then, a function like this:

ConstantiaTicks[a_?VectorQ, opts : OptionsPattern[Style]] := 
 Transpose@{a, 
    Style[#, FontFamily -> "Constantia", 
          Sequence @@ {opts}] & /@ (StringJoin /@ 
                Map[ToString[
                         Style[Which[IntegerQ[#], 
                                    FromCharacterCode[# + 8320], # === ".", "."]]] &, 
                                       (getDigits[a]), {2}])}
                                       

Yields the following result:

여기에 이미지 설명 입력

This can then be used in a FrameTicks or Ticks option. Of course it does mean specifying your ticks rather than letting Mathematica work out their values automatically. It also means taking the default tick length unless you want to have another argument to ConstantiaTicks that specifies that.

-------------------

I think this is rather difficult. Constantia is directly usable in Mathematica:

Style["0123456789", FontFamily -> "Constantia", FontSize -> 100]

여기에 이미지 설명 입력

그러나 글꼴은 이러한 방식으로 균형을 이루도록 특별히 설계되었습니다. 당신은 크기와 사용하는 문자의 위치를 조정할 경우,

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
                    

여기에 이미지 설명 입력

이동 및 축척 된 문자의 체중이 다릅니다. 글꼴 두께는 조정할 수 있지만 아주 대략적으로 만 가능합니다. 일반적으로 Plain 및 Bold 스타일 만 있습니다. 따라서 다음과 같이 가까워 질 수 있습니다.

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
                         

여기에 이미지 설명 입력

다소 나아졌지 만 여전히 못 생겼습니다. 나는 이것이 작동하기 위해 편지의 완전히 새로운 디자인이 필요하다고 가정합니다. 아마도 일반 문자는 글꼴 테이블의 어딘가에서 찾을 수 있습니까?


최신 정보

대체 번호 세트를 찾았습니다. 글꼴 테이블의 8320-8329 위치에 있습니다. 글꼴 유틸리티를 사용하여 전환 할 수 있어야합니다.

Style[FromCharacterCode[Range[8320, 8329]],FontFamily -> "Constantia", FontSize -> 100]

여기에 이미지 설명 입력

-------------------
나는

FontForge를

잡을 것이다 . 최신 버전 (기억하는 것 같음)에는 매핑을 적용하고 글꼴에 병합하는 메뉴 옵션이 숨겨져 있으므로

lnum

(대문자 숫자)를 선택 하고 이전 스타일의 안감 대신 콘 스탄 티아 버전을 쉽게 출력 할 수 있습니다. Mathematica 외부에서 이미 만든 숫자입니다. 또는 약간 덜 하이테크 인 Font-forge에서는 소문자 위에있는 안감이나 표 형식 숫자를 복사하여 붙여 넣을 수 있습니다.Font-forge는 예쁘게 보이지는 않지만 실제로는 매우 좋고 글꼴을 조정할 때 매우 편리하기 때문에 약간의 여유를 줄입니다.대체 솔루션으로 Mathematica의 데이터를 플랫 파일로 내보내고 TikZ를 사용하여 XeTeX에서 기본적으로 렌더링 할 생각이 있으십니까? 이것이 제가 일반적으로 사용하는 접근 방식이며 출력은 실제로 훌륭합니다.

출처
https://stackoverflow.com/questions/7414952