IDE에서 고정 폭 글꼴을 사용하는 이유는 무엇입니까?
SO에 대한 몇 가지 글꼴 주제를 보았고 대부분의 사람들이 프로그래밍 작업에 고정 폭 글꼴을 사용하는 것 같습니다. 저는 프로그래밍에 Verdana를 몇 년 동안 사용해 왔으며 고정 폭과 관련된 어떤 것도 놓치지 않고 향상된 가독성을 정말 좋아합니다.
고정 폭 글꼴을 사용하는 이유는 무엇입니까?
전에 비례 글꼴로 코딩하는 것을 고려한 적이 없습니다. 그래서 과학의 이익을 위해 편집자를 바꾸어 놓았습니다.
다음은 몇 가지 쉬운 티켓을 수정 한 후 몇 가지 관찰 사항입니다.
- 코드가 매우 조밀 해 보입니다. 내 코드의 대부분은 약 80 개의 열로, 거의 100 개를 넘지 않습니다. 비례 글꼴은 편집기의 왼쪽에있는 작은 띠로 축소합니다. 화면 공간이 짧은 경우 유용 할 수 있지만 불필요하게 압축 된 것 같습니다.
- 코드의 '텍스처'가 손실됩니다. 내가보고있는 구조의 종류를 말하기는 어렵습니다. 거의 문자별로 읽어야하는 큰 텍스트 조각 일뿐입니다.
- 그것은이다 매우 미스 쉽게
!
연산자를if (!foo)
. (만약 (! foo),보십시오!) - 구두점 문자가 매우 잘못 정의되었습니다. 많은 사람들이 구별하기 어렵다 (
{}[]()
vs {} [] ()) - 일부 구두점 문자는 다른 것보다 훨씬 큽니다. 의도하지 않은 부분을 강조합니다 (
$@%
vs $ @ %) - 일부 문자는 매우 좁고 식별하기 매우 어렵습니다 (
'"!;:,.
vs ' "!; :,.) - 일부 숫자와 문자는 매우 유사합니다 (
0Oo iIl
대 0Oo iIl). - 나는 구문 강조에 매우 의존하고있다. 따옴표가 균형을 이루고 있는지 확인하는 것과 같은 일을하는 것은 거의 불가능하다.
- 정렬 (단순 들여 쓰기 제외)이 완전히 깨졌습니다. 여분의 공간을 던져서 날개를 달 수 있지만 글꼴의 비례 적 특성으로 인해 줄이 정확하게 정렬되지 않을 수 있습니다 . 코드가 더 복잡해 보입니다 .
- 정규 표현식은 .. 흥미 롭습니다!
가 있는 몇 가지 긍정적 인 점은, 그래도. 확실히 나는 잠시 동안 만 사용했지만 비례 글꼴에서 조금 더 잘 작동하는 몇 가지 측면이 있습니다.
- '단어'는 읽기가 더 쉽습니다. 맞춤법 오류 (예 : 변수 철자 오류)가 당신에게 튀어 나옵니다.
- 더 길고 설명적인 변수 이름을 사용하는 것이 더 기분이 좋습니다 (텍스트의 가로 크기가 압축되어 있기 때문일 수 있습니다).
- 이와 같은 코드 를 읽는 것이 약간 더 쉬워 보입니다 . 내 두뇌가 각 단어를 '토큰 화'하고 그 의미를 이해하는 것이 더 쉽습니다. 구두점 문자는 읽기가 더 어렵 기 때문에 여전히 어렵지만 익숙해지기 위해 약간의 시간이 주어지면 변경 될 수 있습니다.
내일 다시이 답변을 업데이트하겠습니다 (이렇게 하루 종일 할 수 있다고 가정합니다!)
고정 폭 글꼴 :
- 길이가 같은 문자열 리터럴은 동일하게 보입니다.
- 다음과 같이가는 구두점을 보는 것이 더 쉽습니다. () {}
- 비슷한 캐릭터가 더 다르게 보입니다 : Il 0O vs
Il 0O
- X 자 너비의 창에서 줄 바꿈 여부를 알고 있습니다. 즉, 팀은 100 자 라인으로 표준화 할 수 있으며 라인은 항상 라인처럼 보입니다.
관련 조건문을 정렬하여 그룹화되어 있음을 더 분명하게 만들고 싶습니다. 예를 들면 :
if ((var1 == FOO) && ((var2 == BAR) ||
(var2 == FOOBAR)))
가변 너비 글꼴은 이것을 더 어렵게 만듭니다.
여기서 제가 계속보고있는 것은 "코드 정렬"과 들여 쓰기에 대한 논의입니다. 다음 사항을 지적하고 싶습니다.
- 8 개의 공백은 항상 모든 글꼴에서 4 개의 공백의 두 배입니다.
- 두 탭은 항상 모든 글꼴에서 한 탭의 두 배입니다.
- 한 줄의 식별자는 모든 글꼴에서 항상 다음 줄의 너비가 동일합니다!
- 팀원이 고정 폭을 사용하고 있고 그렇지 않은 경우에는 다르게 보일 것입니다.하지만 무엇이든 표준화해야합니다. 그것이 무엇이든간에, 그것이 사실이라면 모든 사람에게 동일하게 보일 것입니다. .. 모든 글꼴로! 웃음을 위해 모든 사람을 고정 폭으로 유지하고 절반은 와이드 스크린 모니터를 제공 할 수도 있습니다.
- 사용중인 식별자의 범위가 아니라 화면에서 해당 문자의 열 위치를 기반으로 코드를 정렬하는 데 의존하는 작업을 수행하는 경우 수행중인 작업이 해킹이라고 생각합니다. 식별자는 이름의 품질을 희생하여 특정 문자 수로 제한되어서는 안됩니다. 그 외에는 ... 코드의 주석에 별표가있는 ASCII 상자를 아직 그리지 않습니까?
따라서이 모든 것을 함께 그리면 각 줄을 같은 위치에서 시작하고 일관된 간격이 같은 너비이고 식별자가 각 줄의 너비를 자발적으로 변경하지 않으면 코드가 실제로 정렬됩니다! ... 무언가가 다를 때까지.
예를 들면 :
identifier.Method().Property.ToString();
identifier.Method().OtherGuy.ToString(); //how lined up and pretty!
identifier.Method().Sumthing.YouGetThePoint;
- identifier.Method (). Property.ToString ();
- identifier.Method (). OtherGuy.ToString (); // 오 안돼! 어긋난!
- identifier.Method (). Sumthing.YouGetThePoint; // ...하지만 누가 신경 쓰나요? 그들은 다른 속성입니다!
제가 인정할 점은 영숫자가 아닌 문자는 일반적으로 그다지 넓지 않다는 것입니다. 여기에는) (] [} {,: | "; ',`! 및이 포함됩니다. 그러나 이것은 글꼴 편집기에서 간단히 수정할 수 있습니다. 단순히 글꼴을 더 넓게 만들어 문제가되지 않습니다. 수요가 많지 않아서 아직 완료되지 않았습니다.
요약하면 개인적 선호도는 괜찮지 만, 비단 일 공간보다 모노 스페이스를 선호하는 실질적인 이유는 거의 없다고 생각합니다. 당신은 그것의 모습을 좋아합니까? 물론 고정 폭을 사용하십시오. 화면에 더 많은 항목을 표시 하시겠습니까? 모노가 아닙니다. 그러나 사람들이 비단 일 공간을 이단처럼 취급하는 방식은 약간 과장되어 있습니다.
고정 폭 글꼴에 대한 많은 주장이 약간의 조정으로 쉽게 반박 될 수 있기 때문에이 스레드에 대해 궁금해졌습니다. 그래서 나는 IDE를 Calibri로 바꿨다 (왜냐하면 그것은 멋지고 둥근 얼굴을 가지고 있고 UI 화면에서 가독성을 위해 최적화 되었기 때문이다 – 완벽하다). 이제 분명히 들여 쓰기를 위해 공백 대신 탭을 사용해야하고 (모든 문제를 무시하고) 4 개의 공백 너비는 분명히 충분하지 않아서 10으로 전환했습니다.
이제 꽤 좋아 보인다. 그러나 내가 발견 할 수있는 몇 가지 명백한 문제가 있습니다. 이 설정을 잠시 테스트 한 후 나중에 더 많이 나타날 수 있습니다.
- 이미 언급했듯이 일부 문자 (특히 괄호, 세미콜론)는 너무 얇아 보입니다. 나는 이것을 연속적인 텍스트로 원하지만 소스 코드에서는 원하지 않습니다. 이것이 가장 큰 문제라고 생각합니다.
기호가 잘 정렬되지 않습니다. 예를 들어 다음 C # 코드를 고려하십시오.
var expr = x => x + 1;
화살표 (
=>
)는 고정 폭 글꼴에 대한 단위처럼 보입니다. 다른 글꼴에서는 두 개의 인접한 문자처럼 보입니다.>>
등의 연산자도 마찬가지입니다 .- 공간이 작게 보입니다. 가독성을 높이기 위해 소스 코드 간격을 정교하게 배치합니다. 비례 글꼴로 전환 할 때 이것은 소용이 없습니다. 공간의 너비를 제어 할 수 있다면 확실히 도움이 될 것입니다.
Context-sensitive indentation is completely broken: in some contexts it's not enough to indentate a fixed number of tabs. Take LINQ expressions which might be indented in the following way:
var r = from c in "This, apparently, is a test!" where !char.IsPunctuation(c) select char.ToUpper(c);
You simply can't do this with a proportional font.
All in all, characters are too narrow. Again, an additional letter-spacing might help and it's definitely necessary in the case of punctiuation. However, I've got the feeling that all this tweaking to make proportional fonts more readable would just emulate what monospaced fonts to naturally. It's certainly true for all the points mentioned so far.
I use Comic Sans MS, which looks quite reasonable as small point sizes (it only starts looking "jokey" at headline sizes). It's easy on the eyes, yet still keep the text small enough to have a reasonable amount of code visible in the text window, with several of VS's docked panels open.
You can have the Solution Explorer panel out, and still have 100 columns of text readable without horizontal scrolling. Moveover, I can have the DXCore Documentor panel (displaying formatted XMLDOCs) open wide enough to read while still being able to see enough of the text to doc the XMLdocs.
If you work in a team then mono-spaced fonts ensure that code is clear and correctly layed out for everyone, whatever mono-spaced font they prefer to use.
Your code may look clear to you when using a variable width font but it's unlikely to look the same if a mono-spaced font user opens it.
All it takes is a few hours of trying to figure out why a search isn't finding something because you have 2 spaces instead of 1 in your literal, to realize you should use Monospace fonts. I had this happen to me once when trying to fix a Lotus Notes agent, when the designer wasn't using a monospace font. It wasn't until I pasted the code into CodeWright to print it out that it was obvious what the problem was.
Monospaced fonts make it much easier to line up code.
This is especially true when working with a team; everyone in the team can use different fonts, and as long as they're all monospaced, everything will line up. Similarly, if a single person uses many different development tools, everything will line up if they're all monospaced. If they weren't all monospaced, you'd have to make sure that they all use the same font, and if you're developing on two platforms, that can be difficult.
In fact, some development tools only support monospaced fonts.
Another reason is that monospaced fonts tend to have more distinct characters. Compare lIiO0 to lIiO0
, and you'll see what I mean. They also make it much easier to count whitespace.
I suspect monospaced fonts were a programmer's preference as a carry-over from the text-based DOS days.
On the other hand, I, myself, have tried Verdana and a couple other recommended proportional fonts, but I couldn't deal with the change. My eye is too well trained for monospace. Languages heavy on symbols, like: C/C++, C#, Perl, etc., look too different for me. The placement of symbols makes the code look completely different.
By the nature of code rather than regular language, it's nicer to have it lined up correctly. Also, in code editing, sometimes you want to block select, block copy and block paste. In Visual Studio, you can do the block selection by using the ALT key while doing your mouse selection. It might be different in different editors, but I've always found that option in an editor very important in some cases, and it wouldn't work very well, unless you are using a mono-spaced font.
I personally find the mono-spaced fonts easier to read in code editors. Of course, I'm almost blind. That might make a difference. I currently run consolas font at 15 point with a dark background with high-contrast letters.
Using spaces for indentation would be a problem once you got deeper than one level.
Mostly for alignment purposes (such as when function parameter declarations span multiple lines and you want to line them up, or lining up comments, etc.).
I think, just like the issue of tab characters, the complicating factor is when something is indented for the purposes of alignment, and someone else has different preferences. Things get misaligned.
참고URL : https://stackoverflow.com/questions/218623/why-use-monospace-fonts-in-your-ide
'IT박스' 카테고리의 다른 글
이미지에서 알파 채널 제거 (0) | 2020.10.20 |
---|---|
vim을 사용할 때 OS X에 crontab 항목이없는 이유는 무엇입니까? (0) | 2020.10.20 |
Ruby Gems가 설치되지 않고 Gems를 가져 오는 동안 중단됨 (0) | 2020.10.20 |
더 나은 루비 마크 다운 인터프리터? (0) | 2020.10.20 |
Bash 변수에서 첫 글자를 얻는 방법은 무엇입니까? (0) | 2020.10.20 |