| 1 | #!/bin/bash |
| 2 | |
| 3 | |
| 4 | |
| 5 | testfont() { |
| 6 | font=$1 |
| 7 | property=$2 |
| 8 | expected_file=$3 |
| 9 | |
| 10 | actual=`fc-match "${font}" "${property}"` |
| 11 | expected=":${property}=$(echo ${expected_file} | sed 's/_/\\_/')" |
| 12 | #echo $actual |
| 13 | #echo $expected |
| 14 | test "${expected}" = "${actual}" || \ |
| 15 | echo "Test failed: For '${font}' ${property}, '${expected}' is expected, but actual: '${actual}'" >&2 |
| 16 | } |
| 17 | |
| 18 | # check file |
| 19 | |
| 20 | testfont "D2Coding ligature" file "/usr/share/fonts/truetype/nanum/D2Coding-Ver1.3.2-20180524-ligature.ttf" |
| 21 | testfont "D2Coding ligature:bold" file "/usr/share/fonts/truetype/nanum/D2CodingBold-Ver1.3.2-20180524-ligature.ttf" |
| 22 | testfont "NanumBarunGothic YetHangul" file "/usr/share/fonts/truetype/nanum/NanumBarunGothic-YetHangul.ttf" |
| 23 | testfont "NanumBarunGothic" file "/usr/share/fonts/truetype/nanum/NanumBarunGothic.ttf" |
| 24 | testfont "NanumBarunGothic:bold" file "/usr/share/fonts/truetype/nanum/NanumBarunGothicBold.ttf" |
| 25 | testfont "NanumBarunGothic:light" file "/usr/share/fonts/truetype/nanum/NanumBarunGothicLight.ttf" |
| 26 | testfont "NanumBarunGothic:ultralight" file "/usr/share/fonts/truetype/nanum/NanumBarunGothicUltraLight.ttf" |
| 27 | testfont "NanumBarunpen:bold" file "/usr/share/fonts/truetype/nanum/NanumBarunpenB.ttf" |
| 28 | testfont "NanumBarunpen" file "/usr/share/fonts/truetype/nanum/NanumBarunpenR.ttf" |
| 29 | testfont "Nanum Brush Script" file "/usr/share/fonts/truetype/nanum/NanumBrush.ttf" |
| 30 | testfont "NanumGothic" file "/usr/share/fonts/truetype/nanum/NanumGothic.ttf" |
| 31 | testfont "NanumGothic:bold" file "/usr/share/fonts/truetype/nanum/NanumGothicBold.ttf" |
| 32 | testfont "NanumGothic:extrabold" file "/usr/share/fonts/truetype/nanum/NanumGothicExtraBold.ttf" |
| 33 | testfont "NanumGothic:light" file "/usr/share/fonts/truetype/nanum/NanumGothicLight.ttf" |
| 34 | testfont "NanumGothic Eco" file "/usr/share/fonts/truetype/nanum/NanumGothicEco.ttf" |
| 35 | testfont "NanumGothic Eco:bold" file "/usr/share/fonts/truetype/nanum/NanumGothicEcoBold.ttf" |
| 36 | testfont "NanumGothic Eco:extrabold" file "/usr/share/fonts/truetype/nanum/NanumGothicEcoExtraBold.ttf" |
| 37 | testfont "NanumMyeongjo YetHangul" file "/usr/share/fonts/truetype/nanum/NanumMyeongjo-YetHangul.ttf" |
| 38 | testfont "NanumMyeongjo" file "/usr/share/fonts/truetype/nanum/NanumMyeongjo.ttf" |
| 39 | testfont "NanumMyeongjo:bold" file "/usr/share/fonts/truetype/nanum/NanumMyeongjoBold.ttf" |
| 40 | testfont "NanumMyeongjo:extrabold" file "/usr/share/fonts/truetype/nanum/NanumMyeongjoExtraBold.ttf" |
| 41 | testfont "NanumMyeongjo Eco" file "/usr/share/fonts/truetype/nanum/NanumMyeongjoEco.ttf" |
| 42 | testfont "NanumMyeongjo Eco:bold" file "/usr/share/fonts/truetype/nanum/NanumMyeongjoEcoBold.ttf" |
| 43 | testfont "NanumMyeongjo Eco:extrabold" file "/usr/share/fonts/truetype/nanum/NanumMyeongjoEcoExtraBold.ttf" |
| 44 | testfont "Nanum Pen Script" file "/usr/share/fonts/truetype/nanum/NanumPen.ttf" |
| 45 | testfont "NanumSquare" file "/usr/share/fonts/truetype/nanum/NanumSquareR.ttf" |
| 46 | testfont "NanumSquare:bold" file "/usr/share/fonts/truetype/nanum/NanumSquareB.ttf" |
| 47 | testfont "NanumSquare:extrabold" file "/usr/share/fonts/truetype/nanum/NanumSquareEB.ttf" |
| 48 | testfont "NanumSquare:light" file "/usr/share/fonts/truetype/nanum/NanumSquareL.ttf" |
| 49 | testfont "NanumSquare Neo variable" file "/usr/share/fonts/truetype/nanum/NanumSquareNeo-Variable.ttf" |
| 50 | testfont "NanumSquare Neo:light" file "/usr/share/fonts/truetype/nanum/NanumSquareNeo-aLt.ttf" |
| 51 | testfont "NanumSquare Neo:regular" file "/usr/share/fonts/truetype/nanum/NanumSquareNeo-bRg.ttf" |
| 52 | testfont "NanumSquare Neo:bold" file "/usr/share/fonts/truetype/nanum/NanumSquareNeo-cBd.ttf" |
| 53 | testfont "NanumSquare Neo:extrabold" file "/usr/share/fonts/truetype/nanum/NanumSquareNeo-dEb.ttf" |
| 54 | testfont "NanumSquare Neo:heavy" file "/usr/share/fonts/truetype/nanum/NanumSquareNeo-eHv.ttf" |
| 55 | testfont "NanumSquareRound:bold" file "/usr/share/fonts/truetype/nanum/NanumSquareRoundB.ttf" |
| 56 | testfont "NanumSquareRound:extrabold" file "/usr/share/fonts/truetype/nanum/NanumSquareRoundEB.ttf" |
| 57 | testfont "NanumSquareRound:light" file "/usr/share/fonts/truetype/nanum/NanumSquareRoundL.ttf" |
| 58 | testfont "NanumSquareRound:regular" file "/usr/share/fonts/truetype/nanum/NanumSquareRoundR.ttf" |
| 59 | testfont "NanumSquare_ac:bold" file "/usr/share/fonts/truetype/nanum/NanumSquare_acB.ttf" |
| 60 | testfont "NanumSquare_ac:extrabold" file "/usr/share/fonts/truetype/nanum/NanumSquare_acEB.ttf" |
| 61 | testfont "NanumSquare_ac:light" file "/usr/share/fonts/truetype/nanum/NanumSquare_acL.ttf" |
| 62 | testfont "NanumSquare_ac:regular" file "/usr/share/fonts/truetype/nanum/NanumSquare_acR.ttf" |
| 63 | testfont "NanumHuman TTF" file "/usr/share/fonts/truetype/nanum/NanumHumanRegular.ttf" |
| 64 | testfont "NanumHuman TTF:extralight" file "/usr/share/fonts/truetype/nanum/NanumHumanEL.ttf" |
| 65 | testfont "NanumHuman TTF:extrabold" file "/usr/share/fonts/truetype/nanum/NanumHumanEB.ttf" |
| 66 | testfont "NanumHuman TTF:heavy" file "/usr/share/fonts/truetype/nanum/NanumHumanHeavy.ttf" |
| 67 | testfont "NanumHuman TTF:bold" file "/usr/share/fonts/truetype/nanum/NanumHumanBold.ttf" |
| 68 | testfont "NanumHuman TTF:light" file "/usr/share/fonts/truetype/nanum/NanumHumanLight.ttf" |
| 69 | |
| 70 | # check weight |
| 71 | |
| 72 | testfont "NanumSquare Neo:bold" weight "200" |
| 73 | testfont "NanumMyeongjo:bold" weight "200" |
| 74 | testfont "NanumMyeongjo:extrabold" weight "205" |
| 75 | testfont "NanumGothic:bold" weight "200" |
| 76 | testfont "NanumGothic:extrabold" weight "205" |
| 77 | testfont "NanumBarunGothic:bold" weight "200" |
| 78 | testfont "NanumBarunGothic:ultralight" weight "40" |
| 79 | testfont "NanumGothic Eco:bold" weight "200" |
| 80 | testfont "NanumMyeongjo Eco:bold" weight "200" |
| 81 | testfont "NanumHuman TTF:bold" weight "200" |
| 82 | |
| 83 | # check style |
| 84 | |
| 85 | testfont "D2Coding ligature:bold" style "Bold" |
| 86 | testfont "NanumGothic:extrabold" style "ExtraBold" |
| 87 | testfont "NanumMyeongjo:extrabold" style "ExtraBold" |
| 88 | testfont "NanumSquare:light" style "Light" |
| 89 | testfont "NanumSquare:bold" style "Bold" |
| 90 | testfont "NanumSquare:extrabold" style "ExtraBold" |
| 91 | testfont "NanumSquare Neo:bold" style "Bold" |
| 92 | testfont "NanumSquare Neo:extrabold" style "ExtraBold" |
| 93 | testfont "NanumSquare Neo:light" style "Light" |
| 94 | testfont "NanumSquare Neo:heavy" style "Heavy" |
| 95 | testfont "NanumHuman TTF:extrabold" style "ExtraBold" |