8000 ➕ 폰트 설정 추가 · paxbun/c-cpp-tutorial@949fb7a · GitHub
[go: up one dir, main page]

Skip to content

Commit 949fb7a

Browse files
committed
➕ 폰트 설정 추가
1 parent 813660a commit 949fb7a

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Visual Studio 에디터의 기능
2+
3+
자주 사용하는 Visual Studio 에디터의 기능을 설명합니다.
4+
5+
# 폰트 설정
6+
7+
코딩을 위해 전용 에디터를 사용하는 것처럼, 코딩을 위한 전용 폰트도 있습니다. 기본적으로 이러한 폰트들은 모든 글자의 너비가 같아야 합니다.
8+
9+
!["Calibri and Consolas"](img/1.png "Calibri and Consolas")
10+
11+
Calibri의 `H``l`의 너비는 다른 반면에, Consolas의 `H``l`은 너비가 같다는 것을 확인할 수 있습니다. 이렇게 모든 글자의 너비가 같은 폰트를 `고정폭 폰트(monospaced font)`라고 합니다. 고정폭 폰트를 사용하면 코드를 더 잘 정리할 수 있고, 코드의 가독성을 높일 수 있습니다.
12+
13+
```cpp
14< 10000 code class="diff-text syntax-highlighted-line addition">+
template <typename StringT = std::string>
15+
struct CaseInsensitiveEqual
16+
{
17+
bool operator()(StringT const& lhs, StringT const& rhs) const
18+
{
19+
using namespace std;
20+
return lhs.size() == rhs.size()
21+
&& equal(lhs.begin(),
22+
lhs.end(),
23+
rhs.begin(),
24+
[](auto l, auto r) {
25+
return tolower(l) == tolower(r);
26+
});
27+
}
28+
};
29+
30+
size_t cnt = std::count_if(v.begin(),
31+
v.end(),
32+
[](auto const& str) {
33+
return CaseInsensitiveEqual<
34+
decltype(v)::value_type> {}(str, "hello");
35+
});
36+
```
37+
38+
> template \<typename StringT = std::wstring_view\>
39+
> struct CaseInsensitiveEqual
40+
> {
41+
> bool operator()(StringT const& lhs, StringT const& rhs) const
42+
> {
43+
> using namespace std;
44+
> return lhs.size() == rhs.size()
45+
> && equal(lhs.begin(),
46+
> lhs.end(),
47+
> rhs.begin(),
48+
> \[\](auto l, auto r) {
49+
> return tolower(l) == tolower(r);
50+
> });
51+
> }
52+
> };
53+
>
54+
> size_t cnt = std\:\:count_if(v.begin(),
55+
> v.end(),
56+
> \[\](auto const& str) {
57+
> return CaseInsensitiveEqual\<
58+
> decltype(v)\:\:value_type\> {}(str, "hello");
59+
> });
60+
61+
너비가 같은 폰트를 사용하면 각 줄의 들여쓰기를 맞출 수 있는 것에 반해, 너비가 서로 다르면 들여쓰기의 간격을 조절하기 힘들다는 것을 알 수 있습니다.
5.7 KB
Loading

0 commit comments

Comments
 (0)
0