๊ฐœ๋ฐœ ๐Ÿพ/HTML,CSS

ํฐํŠธ๋ฅผ ํ•œ๊ธ€๊ณผ ์˜์–ด,์ˆซ์ž ๋”ฐ๋กœ ์ ์šฉํ•˜๊ธฐ (feat. unicode-range)

JOTOKKI 2021. 7. 19. 16:27
728x90

์ฐธ์กฐ1: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range
์ฐธ์กฐ2: https://www.fileformat.info/info/unicode/char/26/index.htm

์œ ๋‹ˆ์ฝ”๋“œ๋ฌธ์žํ‘œ: https://ko.wikipedia.org/wiki/%EC%9C%A0%EB%8B%88%EC%BD%94%EB%93%9C_2000~2FFF

 

ํ”„๋กœ์ ํŠธ๋ฅผ ํ•˜๋‹ค ๋ณด๋ฉด ์ด๋Ÿฐ ๊ฒฝ์šฐ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. 

ํ•œ๊ธ€์„ ๋‚˜๋ˆ”๊ณ ๋”•์œผ๋กœ ํ•ด์ฃผ์‹œ๊ณ , ์˜๋ฌธ,์ˆซ์ž๋Š” OpensSans๋กœ ํ•ด์ฃผ์„ธ์š”!

 

์•„๋ฌด๊ฒƒ๋„ ๋ชจ๋ฅด๋˜ ์‹œ์ ˆ์—๋Š” ์ˆซ์ž๋งˆ๋‹ค ํด๋ž˜์Šค๋ฅผ ์ฃผ์–ด font๋ฅผ ๋‹ค๋ฅด๊ฒŒ ์ ์šฉ์‹œ์ผฐ์Šต๋‹ˆ๋‹ค.

ํ•˜์ง€๋งŒ ์ •๋ง ์‰ฌ์šด ๋ฐฉ๋ฒ•์ด ์žˆ์—ˆ๋”๋ฆฌ๊ตฌ์š”!

๋ฐ”๋กœ unicode-range๋ฅผ ์ง€์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. 

 

unicode-range ๋Š” CSS ๋””์Šคํฌ๋ฆฝํ„ฐ(discriptor)๋กœ์จ, 
@font-face๋กœ ์ •์˜๋œ ํฐํŠธ๋ฅผ ํŠน์ • character์˜ ๋ฒ”์œ„๋ฅผ ์ง€์ •ํ•ด์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 

๋”ฑ ํ•œ ๋‹จ์–ด์— ์†ํ•˜๋Š” ์œ ๋‹ˆ์ฝ”๋“œ๋„ ์ง€์ •ํ•ด ์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 
์˜ˆ๋ฅผ ๋“ค์–ด U+26(U+0026) ๊ฐ™์€ ๊ฒฝ์šฐ๋Š” ํŠน์ˆ˜ ๋ฌธ์ž '&'๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š”๋ฐ, 
์ด๋ฅผ unicode-range์— ์ง€์ •ํ•ด ์ค€๋‹ค๋ฉด, &๋งŒ @font-face๋กœ ์ •์˜๋œ ํฐํŠธ๊ฐ€ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค. 

๋ฒ”์œ„๋ฅผ ์ง€์ •ํ•˜๊ณ ์‹ถ๋‹ค๋ฉด, U+0025-00FF์ด๋Ÿฐ์‹์œผ๋กœ - ๋ฅผ ํ†ตํ•ด start-end๋ฅผ ์ง€์ •ํ•ด ์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 
์—ฌ๊ธฐ์„œ๋Š” U+0025 ๋ถ€ํ„ฐ U+00FF ๊นŒ์ง€๋ฅผ ์˜๋ฏธํ•˜๋Š”๊ฑธ๋กœ ๋ณด์•„ - ์ดํ›„์— ์˜ค๋Š” ์œ ๋‹ˆ์ฝ”๋“œ์—๋Š” U+๋ฅผ ์ƒ๋žต ํ•˜๋Š”๊ฑธ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค. 

 

์˜ˆ๋ฅผ๋“ค์–ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. 

ํ™•์—ฐํ•œ ์ฐจ์ด๋ฅผ ์œ„ํ•ด ํ•œ๊ธ€ํฐํŠธ๋ฅผ ์กฐ์„ ์ฒด๋กœ ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

<p>์•ˆ๋…•ํ•˜์„ธ์š” ๋‚˜&&&&๋„ˆ</p>
@font-face {
    font-family: 'ChosunCentennial';
    src: url(../fonts/ChosunCentennial/ChosunCentennial.eot);
    src: url(../fonts/ChosunCentennial/ChosunCentennial.eot?#iefix) format('embedded-opentype'),
         url(../fonts/ChosunCentennial/ChosunCentennial.woff) format('woff'),
         url(../fonts/ChosunCentennial/ChosunCentennial.ttf) format('truetype');
         unicode-range: U+AC00-D7A3;
        }

@font-face {
    font-family: 'OpenSans';
    src: url(../fonts/OpenSans/OpenSans-Regular.eot);
    src: url(../fonts/OpenSans/OpenSans-Regular.eot?#iefix) format('embedded-opentype'),
         url(../fonts/OpenSans/OpenSans-Regular.woff) format('woff'),
         url(../fonts/OpenSans/OpenSans-Regular.ttf) format('truetype');
         unicode-range: U+26;
}


body {
    font-size: 35px;
    font-family: 'ChosunCentennial', 'OpenSans';
}

* {
    font-family: inherit;
}

์ด๋ ‡๊ฒŒ ํ•ด์ฃผ๋ฉด ํ•œ๊ธ€(U+AC00-D7A3)์€ ChosunCentennial์ฒด๊ฐ€ ์ ์šฉ๋˜๊ณ , 

ํŠน์ˆ˜๊ธฐํ˜ธ &(U+26)๋งŒ OpenSans๋กœ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค. 

๊ฒฐ๊ณผํ™”๋ฉด

 

 

* ์ž์ฃผ ์‚ฌ์šฉํ•  ๋งŒํ•œ ์œ ๋‹ˆ์ฝ”๋“œ ๋ฒ”์œ„

ํ•œ๊ธ€ ๋ฒ”์œ„:  U+AC00-D7A3
์˜์–ด ๋Œ€๋ฌธ์ž ๋ฒ”์œ„ :  U+0041-005A
์˜์–ด ์†Œ๋ฌธ์ž ๋ฒ”์œ„ :   U+0061-007A
์ˆซ์ž ๋ฒ”์œ„ : U+0030-0039
ํŠน์ˆ˜ ๋ฌธ์ž: U+0020-002F, U+003A-0040, U+005B-0060, U+007B-007E

 

์œ„์˜ ์ฝ”๋“œ๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๋‹ค์–‘ํ•˜๊ฒŒ ๋ฒ”์œ„๋ฅผ ์ง€์ •ํ•˜์—ฌ ํฐํŠธ๋ฅผ ์ค„ ์ˆ˜ ์žˆ๋‹ค!

 

๋ฐ˜์‘ํ˜•