[{"data":1,"prerenderedAt":1322},["ShallowReactive",2],{"blog-en-source-han-sans-jp-with-gpdf":3},{"id":4,"title":5,"author":6,"body":9,"date":1286,"description":1287,"draft":1288,"extension":1289,"howTo":1290,"image":1312,"meta":1313,"navigation":87,"path":1314,"seo":1315,"stem":1316,"tags":1317,"updated":1312,"__hash__":1321},"blog/blog/010.source-han-sans-jp-with-gpdf.md","How do I use Source Han Sans JP with gpdf?",{"name":7,"url":8},"gpdf team","https://gpdf.dev",{"type":10,"value":11,"toc":1274},"minimark",[12,17,34,38,56,60,709,722,726,737,740,824,832,836,870,877,901,910,914,917,925,928,1083,1097,1100,1104,1107,1144,1158,1162,1165,1180,1183,1198,1201,1205,1234,1238,1241,1258,1270],[13,14,16],"h2",{"id":15},"the-question-in-other-words","The question, in other words",[18,19,20,21,25,26,33],"p",{},"You want to use ",[22,23,24],"strong",{},"Source Han Sans JP"," — Adobe's open-source pan-CJK sans-serif, released in 2014 as the product of the Adobe–Google partnership — in a ",[27,28,32],"a",{"href":29,"rel":30},"https://github.com/gpdf-dev/gpdf",[31],"nofollow","gpdf"," document. Maybe your team pins fonts to GitHub release tags for reproducibility, maybe you inherited a design system that standardized on Source Han years ago, maybe you just prefer Adobe's release cadence. Whatever the reason, three things are worth getting straight before you download anything: which file to grab, what the actual relationship to Noto Sans JP is, and which format gpdf can read.",[13,35,37],{"id":36},"tldr","TL;DR",[18,39,40,41,45,46,51,52,55],{},"Download ",[42,43,44],"code",{},"SourceHanSansJP-Regular.ttf"," from the ",[27,47,50],{"href":48,"rel":49},"https://github.com/adobe-fonts/source-han-sans/releases",[31],"adobe-fonts/source-han-sans"," release page (the TTF bundle, not the default OTF), pass it to ",[42,53,54],{},"gpdf.WithFont(\"SourceHanSansJP\", bytes)",", and set it as the default. Source Han Sans JP and Noto Sans JP share the same glyph outlines — if none of Adobe's tooling story matters to you, Noto is a friendlier download.",[13,57,59],{"id":58},"the-complete-example","The complete example",[61,62,67],"pre",{"className":63,"code":64,"language":65,"meta":66,"style":66},"language-go shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","package main\n\nimport (\n    \"log\"\n    \"os\"\n\n    \"github.com/gpdf-dev/gpdf\"\n    \"github.com/gpdf-dev/gpdf/document\"\n    \"github.com/gpdf-dev/gpdf/template\"\n)\n\nfunc main() {\n    font, err := os.ReadFile(\"SourceHanSansJP-Regular.ttf\")\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    doc := gpdf.NewDocument(\n        gpdf.WithPageSize(gpdf.A4),\n        gpdf.WithMargins(document.UniformEdges(document.Mm(20))),\n        gpdf.WithFont(\"SourceHanSansJP\", font),\n        gpdf.WithDefaultFont(\"SourceHanSansJP\", 11),\n    )\n\n    page := doc.AddPage()\n    page.AutoRow(func(r *template.RowBuilder) {\n        r.Col(12, func(c *template.ColBuilder) {\n            c.Text(\"報告書\", template.FontSize(24), template.Bold())\n            c.Text(\"Source Han Sans JP — Adobe 配布の無料 CJK フォント。\")\n        })\n    })\n\n    data, err := doc.Generate()\n    if err != nil {\n        log.Fatal(err)\n    }\n    if err := os.WriteFile(\"report.pdf\", data, 0o644); err != nil {\n        log.Fatal(err)\n    }\n}\n","go","",[42,68,69,82,89,99,111,121,126,136,146,156,162,167,183,221,237,255,261,266,285,308,346,372,397,403,408,427,461,498,546,566,572,578,583,604,617,632,637,683,698,703],{"__ignoreMap":66},[70,71,74,78],"span",{"class":72,"line":73},"line",1,[70,75,77],{"class":76},"sMK4o","package",[70,79,81],{"class":80},"sBMFI"," main\n",[70,83,85],{"class":72,"line":84},2,[70,86,88],{"emptyLinePlaceholder":87},true,"\n",[70,90,92,96],{"class":72,"line":91},3,[70,93,95],{"class":94},"s7zQu","import",[70,97,98],{"class":76}," (\n",[70,100,102,105,108],{"class":72,"line":101},4,[70,103,104],{"class":76},"    \"",[70,106,107],{"class":80},"log",[70,109,110],{"class":76},"\"\n",[70,112,114,116,119],{"class":72,"line":113},5,[70,115,104],{"class":76},[70,117,118],{"class":80},"os",[70,120,110],{"class":76},[70,122,124],{"class":72,"line":123},6,[70,125,88],{"emptyLinePlaceholder":87},[70,127,129,131,134],{"class":72,"line":128},7,[70,130,104],{"class":76},[70,132,133],{"class":80},"github.com/gpdf-dev/gpdf",[70,135,110],{"class":76},[70,137,139,141,144],{"class":72,"line":138},8,[70,140,104],{"class":76},[70,142,143],{"class":80},"github.com/gpdf-dev/gpdf/document",[70,145,110],{"class":76},[70,147,149,151,154],{"class":72,"line":148},9,[70,150,104],{"class":76},[70,152,153],{"class":80},"github.com/gpdf-dev/gpdf/template",[70,155,110],{"class":76},[70,157,159],{"class":72,"line":158},10,[70,160,161],{"class":76},")\n",[70,163,165],{"class":72,"line":164},11,[70,166,88],{"emptyLinePlaceholder":87},[70,168,170,173,177,180],{"class":72,"line":169},12,[70,171,172],{"class":76},"func",[70,174,176],{"class":175},"s2Zo4"," main",[70,178,179],{"class":76},"()",[70,181,182],{"class":76}," {\n",[70,184,186,190,193,196,199,202,205,208,211,214,217,219],{"class":72,"line":185},13,[70,187,189],{"class":188},"sTEyZ","    font",[70,191,192],{"class":76},",",[70,194,195],{"class":188}," err ",[70,197,198],{"class":76},":=",[70,200,201],{"class":188}," os",[70,203,204],{"class":76},".",[70,206,207],{"class":175},"ReadFile",[70,209,210],{"class":76},"(",[70,212,213],{"class":76},"\"",[70,215,44],{"class":216},"sfazB",[70,218,213],{"class":76},[70,220,161],{"class":76},[70,222,224,227,229,232,235],{"class":72,"line":223},14,[70,225,226],{"class":94},"    if",[70,228,195],{"class":188},[70,230,231],{"class":76},"!=",[70,233,234],{"class":76}," nil",[70,236,182],{"class":76},[70,238,240,243,245,248,250,253],{"class":72,"line":239},15,[70,241,242],{"class":188},"        log",[70,244,204],{"class":76},[70,246,247],{"class":175},"Fatal",[70,249,210],{"class":76},[70,251,252],{"class":188},"err",[70,254,161],{"class":76},[70,256,258],{"class":72,"line":257},16,[70,259,260],{"class":76},"    }\n",[70,262,264],{"class":72,"line":263},17,[70,265,88],{"emptyLinePlaceholder":87},[70,267,269,272,274,277,279,282],{"class":72,"line":268},18,[70,270,271],{"class":188},"    doc ",[70,273,198],{"class":76},[70,275,276],{"class":188}," gpdf",[70,278,204],{"class":76},[70,280,281],{"class":175},"NewDocument",[70,283,284],{"class":76},"(\n",[70,286,288,291,293,296,298,300,302,305],{"class":72,"line":287},19,[70,289,290],{"class":188},"        gpdf",[70,292,204],{"class":76},[70,294,295],{"class":175},"WithPageSize",[70,297,210],{"class":76},[70,299,32],{"class":188},[70,301,204],{"class":76},[70,303,304],{"class":188},"A4",[70,306,307],{"class":76},"),\n",[70,309,311,313,315,318,320,323,325,328,330,332,334,337,339,343],{"class":72,"line":310},20,[70,312,290],{"class":188},[70,314,204],{"class":76},[70,316,317],{"class":175},"WithMargins",[70,319,210],{"class":76},[70,321,322],{"class":188},"document",[70,324,204],{"class":76},[70,326,327],{"class":175},"UniformEdges",[70,329,210],{"class":76},[70,331,322],{"class":188},[70,333,204],{"class":76},[70,335,336],{"class":175},"Mm",[70,338,210],{"class":76},[70,340,342],{"class":341},"sbssI","20",[70,344,345],{"class":76},"))),\n",[70,347,349,351,353,356,358,360,363,365,367,370],{"class":72,"line":348},21,[70,350,290],{"class":188},[70,352,204],{"class":76},[70,354,355],{"class":175},"WithFont",[70,357,210],{"class":76},[70,359,213],{"class":76},[70,361,362],{"class":216},"SourceHanSansJP",[70,364,213],{"class":76},[70,366,192],{"class":76},[70,368,369],{"class":188}," font",[70,371,307],{"class":76},[70,373,375,377,379,382,384,386,388,390,392,395],{"class":72,"line":374},22,[70,376,290],{"class":188},[70,378,204],{"class":76},[70,380,381],{"class":175},"WithDefaultFont",[70,383,210],{"class":76},[70,385,213],{"class":76},[70,387,362],{"class":216},[70,389,213],{"class":76},[70,391,192],{"class":76},[70,393,394],{"class":341}," 11",[70,396,307],{"class":76},[70,398,400],{"class":72,"line":399},23,[70,401,402],{"class":76},"    )\n",[70,404,406],{"class":72,"line":405},24,[70,407,88],{"emptyLinePlaceholder":87},[70,409,411,414,416,419,421,424],{"class":72,"line":410},25,[70,412,413],{"class":188},"    page ",[70,415,198],{"class":76},[70,417,418],{"class":188}," doc",[70,420,204],{"class":76},[70,422,423],{"class":175},"AddPage",[70,425,426],{"class":76},"()\n",[70,428,430,433,435,438,441,445,448,451,453,456,459],{"class":72,"line":429},26,[70,431,432],{"class":188},"    page",[70,434,204],{"class":76},[70,436,437],{"class":175},"AutoRow",[70,439,440],{"class":76},"(func(",[70,442,444],{"class":443},"sHdIc","r",[70,446,447],{"class":76}," *",[70,449,450],{"class":80},"template",[70,452,204],{"class":76},[70,454,455],{"class":80},"RowBuilder",[70,457,458],{"class":76},")",[70,460,182],{"class":76},[70,462,464,467,469,472,474,477,479,482,485,487,489,491,494,496],{"class":72,"line":463},27,[70,465,466],{"class":188},"        r",[70,468,204],{"class":76},[70,470,471],{"class":175},"Col",[70,473,210],{"class":76},[70,475,476],{"class":341},"12",[70,478,192],{"class":76},[70,480,481],{"class":76}," func(",[70,483,484],{"class":443},"c",[70,486,447],{"class":76},[70,488,450],{"class":80},[70,490,204],{"class":76},[70,492,493],{"class":80},"ColBuilder",[70,495,458],{"class":76},[70,497,182],{"class":76},[70,499,501,504,506,509,511,513,516,518,520,523,525,528,530,533,536,538,540,543],{"class":72,"line":500},28,[70,502,503],{"class":188},"            c",[70,505,204],{"class":76},[70,507,508],{"class":175},"Text",[70,510,210],{"class":76},[70,512,213],{"class":76},[70,514,515],{"class":216},"報告書",[70,517,213],{"class":76},[70,519,192],{"class":76},[70,521,522],{"class":188}," template",[70,524,204],{"class":76},[70,526,527],{"class":175},"FontSize",[70,529,210],{"class":76},[70,531,532],{"class":341},"24",[70,534,535],{"class":76},"),",[70,537,522],{"class":188},[70,539,204],{"class":76},[70,541,542],{"class":175},"Bold",[70,544,545],{"class":76},"())\n",[70,547,549,551,553,555,557,559,562,564],{"class":72,"line":548},29,[70,550,503],{"class":188},[70,552,204],{"class":76},[70,554,508],{"class":175},[70,556,210],{"class":76},[70,558,213],{"class":76},[70,560,561],{"class":216},"Source Han Sans JP — Adobe 配布の無料 CJK フォント。",[70,563,213],{"class":76},[70,565,161],{"class":76},[70,567,569],{"class":72,"line":568},30,[70,570,571],{"class":76},"        })\n",[70,573,575],{"class":72,"line":574},31,[70,576,577],{"class":76},"    })\n",[70,579,581],{"class":72,"line":580},32,[70,582,88],{"emptyLinePlaceholder":87},[70,584,586,589,591,593,595,597,599,602],{"class":72,"line":585},33,[70,587,588],{"class":188},"    data",[70,590,192],{"class":76},[70,592,195],{"class":188},[70,594,198],{"class":76},[70,596,418],{"class":188},[70,598,204],{"class":76},[70,600,601],{"class":175},"Generate",[70,603,426],{"class":76},[70,605,607,609,611,613,615],{"class":72,"line":606},34,[70,608,226],{"class":94},[70,610,195],{"class":188},[70,612,231],{"class":76},[70,614,234],{"class":76},[70,616,182],{"class":76},[70,618,620,622,624,626,628,630],{"class":72,"line":619},35,[70,621,242],{"class":188},[70,623,204],{"class":76},[70,625,247],{"class":175},[70,627,210],{"class":76},[70,629,252],{"class":188},[70,631,161],{"class":76},[70,633,635],{"class":72,"line":634},36,[70,636,260],{"class":76},[70,638,640,642,644,646,648,650,653,655,657,660,662,664,667,669,672,675,677,679,681],{"class":72,"line":639},37,[70,641,226],{"class":94},[70,643,195],{"class":188},[70,645,198],{"class":76},[70,647,201],{"class":188},[70,649,204],{"class":76},[70,651,652],{"class":175},"WriteFile",[70,654,210],{"class":76},[70,656,213],{"class":76},[70,658,659],{"class":216},"report.pdf",[70,661,213],{"class":76},[70,663,192],{"class":76},[70,665,666],{"class":188}," data",[70,668,192],{"class":76},[70,670,671],{"class":341}," 0o644",[70,673,674],{"class":76},");",[70,676,195],{"class":188},[70,678,231],{"class":76},[70,680,234],{"class":76},[70,682,182],{"class":76},[70,684,686,688,690,692,694,696],{"class":72,"line":685},38,[70,687,242],{"class":188},[70,689,204],{"class":76},[70,691,247],{"class":175},[70,693,210],{"class":76},[70,695,252],{"class":188},[70,697,161],{"class":76},[70,699,701],{"class":72,"line":700},39,[70,702,260],{"class":76},[70,704,706],{"class":72,"line":705},40,[70,707,708],{"class":76},"}\n",[18,710,711,712,715,716,719,720,204],{},"Drop the TTF next to ",[42,713,714],{},"main.go",", ",[42,717,718],{},"go run main.go",". A one-page PDF with Japanese lands in ",[42,721,659],{},[13,723,725],{"id":724},"source-han-sans-jp-is-noto-sans-cjk-jp","Source Han Sans JP is Noto Sans CJK JP",[18,727,728,729,732,733,736],{},"The one fact that saves you hours of reading: ",[22,730,731],{},"Source Han Sans and Noto Sans CJK are the same fonts",". Adobe did the glyph design, metrics, and coverage work. Google handled a parallel distribution channel under the Noto umbrella. Both launched on 2014-07-15. The outlines, ",[42,734,735],{},"hmtx",", and JIS X 0213 / Adobe-Japan1-6 coverage are identical, bit for bit. When Adobe ships a version bump, the glyph changes propagate to Noto within weeks.",[18,738,739],{},"What actually differs is branding and packaging:",[741,742,743,757],"table",{},[744,745,746],"thead",{},[747,748,749,752,754],"tr",{},[750,751],"th",{},[750,753,24],{},[750,755,756],{},"Noto Sans JP",[758,759,760,772,791,802,813],"tbody",{},[747,761,762,766,769],{},[763,764,765],"td",{},"Publisher",[763,767,768],{},"Adobe",[763,770,771],{},"Google",[747,773,774,777,783],{},[763,775,776],{},"Canonical source",[763,778,779],{},[27,780,50],{"href":781,"rel":782},"https://github.com/adobe-fonts/source-han-sans",[31],[763,784,785,790],{},[27,786,789],{"href":787,"rel":788},"https://notofonts.github.io",[31],"notofonts.github.io"," + Google Fonts",[747,792,793,796,799],{},[763,794,795],{},"Default format",[763,797,798],{},"OTF (CFF outlines)",[763,800,801],{},"TTF (static) + variable",[747,803,804,807,810],{},[763,805,806],{},"Release model",[763,808,809],{},"GitHub release tags, versioned manually",[763,811,812],{},"Google Fonts CDN + git repos",[747,814,815,818,821],{},[763,816,817],{},"Language bundling",[763,819,820],{},"Per-language TTF + pan-CJK OTC",[763,822,823],{},"JP-only",[18,825,826,827,831],{},"Pick Source Han Sans JP when your team pins fonts to Adobe's GitHub tags, mirrors Adobe internally, or wants the pan-CJK OTC bundle for other pipelines. Pick Noto Sans JP when you want the shortest path to a TTF file. See the ",[27,828,830],{"href":829},"/blog/noto-sans-jp-with-gpdf","Noto Sans JP recipe"," for that path.",[13,833,835],{"id":834},"why-ttf-and-not-otf","Why TTF, and not OTF",[18,837,838,839,842,843,846,847,715,850,715,853,715,856,858,859,862,863,866,867,869],{},"Adobe's default asset for Source Han Sans is ",[42,840,841],{},".otf"," — specifically CFF-based OpenType. gpdf's font parser lives in one file (",[42,844,845],{},"pdf/font/truetype.go",") and it reads ",[42,848,849],{},"glyf",[42,851,852],{},"loca",[42,854,855],{},"cmap",[42,857,735],{},", and composite glyphs. It does not read ",[42,860,861],{},"CFF "," or ",[42,864,865],{},"CFF2"," outlines. Hand it a CFF-flavored ",[42,868,841],{}," and the parser rejects the file at document construction, long before you generate anything.",[18,871,872,873,876],{},"The Adobe release page publishes both OTF and TTF variants. Grab the ",[22,874,875],{},"TTF bundle",". If your release archive happens to contain only OTF (occasionally true for point releases), two clean alternatives:",[878,879,880,887],"ol",{},[881,882,883,886],"li",{},[22,884,885],{},"Switch to Noto Sans JP."," Google Fonts serves static TTFs directly; the glyph data is identical. Zero conversion, same output.",[881,888,889,892,893,896,897,900],{},[22,890,891],{},"Convert once, commit the result."," ",[42,894,895],{},"fonttools"," (",[42,898,899],{},"otf2ttf",") produces a TTF in a minute. Check it into your repo or an internal artifact server so the conversion is never in your build path.",[18,902,903,904,906,907,204],{},"Avoid anything that does the conversion at build time. Font conversion tools change behavior across versions, and a silently different ",[42,905,735],{}," table will shift your line breaks after a ",[42,908,909],{},"pip install -U",[13,911,913],{"id":912},"the-seven-weights","The seven weights",[18,915,916],{},"Source Han Sans JP publishes ExtraLight → Heavy, one file per weight:",[61,918,923],{"className":919,"code":921,"language":922},[920],"language-text","SourceHanSansJP-ExtraLight.ttf\nSourceHanSansJP-Light.ttf\nSourceHanSansJP-Normal.ttf\nSourceHanSansJP-Regular.ttf\nSourceHanSansJP-Medium.ttf\nSourceHanSansJP-Bold.ttf\nSourceHanSansJP-Heavy.ttf\n","text",[42,924,921],{"__ignoreMap":66},[18,926,927],{},"For most business documents, Regular and Bold cover what you need:",[61,929,931],{"className":63,"code":930,"language":65,"meta":66,"style":66},"reg,  _ := os.ReadFile(\"SourceHanSansJP-Regular.ttf\")\nbold, _ := os.ReadFile(\"SourceHanSansJP-Bold.ttf\")\n\ndoc := gpdf.NewDocument(\n    gpdf.WithFont(\"SourceHanSansJP\", reg),\n    gpdf.WithFont(\"SourceHanSansJP-Bold\", bold),\n    gpdf.WithDefaultFont(\"SourceHanSansJP\", 11),\n)\n",[42,932,933,961,990,994,1009,1033,1057,1079],{"__ignoreMap":66},[70,934,935,938,940,943,945,947,949,951,953,955,957,959],{"class":72,"line":73},[70,936,937],{"class":188},"reg",[70,939,192],{"class":76},[70,941,942],{"class":188},"  _ ",[70,944,198],{"class":76},[70,946,201],{"class":188},[70,948,204],{"class":76},[70,950,207],{"class":175},[70,952,210],{"class":76},[70,954,213],{"class":76},[70,956,44],{"class":216},[70,958,213],{"class":76},[70,960,161],{"class":76},[70,962,963,966,968,971,973,975,977,979,981,983,986,988],{"class":72,"line":84},[70,964,965],{"class":188},"bold",[70,967,192],{"class":76},[70,969,970],{"class":188}," _ ",[70,972,198],{"class":76},[70,974,201],{"class":188},[70,976,204],{"class":76},[70,978,207],{"class":175},[70,980,210],{"class":76},[70,982,213],{"class":76},[70,984,985],{"class":216},"SourceHanSansJP-Bold.ttf",[70,987,213],{"class":76},[70,989,161],{"class":76},[70,991,992],{"class":72,"line":91},[70,993,88],{"emptyLinePlaceholder":87},[70,995,996,999,1001,1003,1005,1007],{"class":72,"line":101},[70,997,998],{"class":188},"doc ",[70,1000,198],{"class":76},[70,1002,276],{"class":188},[70,1004,204],{"class":76},[70,1006,281],{"class":175},[70,1008,284],{"class":76},[70,1010,1011,1014,1016,1018,1020,1022,1024,1026,1028,1031],{"class":72,"line":113},[70,1012,1013],{"class":188},"    gpdf",[70,1015,204],{"class":76},[70,1017,355],{"class":175},[70,1019,210],{"class":76},[70,1021,213],{"class":76},[70,1023,362],{"class":216},[70,1025,213],{"class":76},[70,1027,192],{"class":76},[70,1029,1030],{"class":188}," reg",[70,1032,307],{"class":76},[70,1034,1035,1037,1039,1041,1043,1045,1048,1050,1052,1055],{"class":72,"line":123},[70,1036,1013],{"class":188},[70,1038,204],{"class":76},[70,1040,355],{"class":175},[70,1042,210],{"class":76},[70,1044,213],{"class":76},[70,1046,1047],{"class":216},"SourceHanSansJP-Bold",[70,1049,213],{"class":76},[70,1051,192],{"class":76},[70,1053,1054],{"class":188}," bold",[70,1056,307],{"class":76},[70,1058,1059,1061,1063,1065,1067,1069,1071,1073,1075,1077],{"class":72,"line":128},[70,1060,1013],{"class":188},[70,1062,204],{"class":76},[70,1064,381],{"class":175},[70,1066,210],{"class":76},[70,1068,213],{"class":76},[70,1070,362],{"class":216},[70,1072,213],{"class":76},[70,1074,192],{"class":76},[70,1076,394],{"class":341},[70,1078,307],{"class":76},[70,1080,1081],{"class":72,"line":138},[70,1082,161],{"class":76},[18,1084,1085,1086,1089,1090,1093,1094,1096],{},"The suffix ",[42,1087,1088],{},"-Bold"," is the contract that wires ",[42,1091,1092],{},"template.Bold()"," to the Bold TTF. Skip that registration and ",[42,1095,1092],{}," falls back to a synthesized bold — a stroke overlay on the Regular glyphs. Legible for table headings, but visibly thinner than the real Bold outlines at display sizes.",[18,1098,1099],{},"CJK fonts don't ship italic variants as a rule, and Source Han Sans JP is no exception. If your layout needs italic emphasis on a Japanese run, reach for a heavier weight or color — an oblique transform on CJK glyphs looks broken rather than emphatic.",[13,1101,1103],{"id":1102},"pan-cjk-jp-only-or-the-super-otc","Pan-CJK, JP-only, or the Super OTC",[18,1105,1106],{},"Adobe publishes Source Han Sans in several granularities. They are not interchangeable for a Go PDF generator:",[1108,1109,1110,1123,1133],"ul",{},[881,1111,1112,1115,1116,1119,1120,1122],{},[22,1113,1114],{},"SourceHanSans.ttc"," (Super OTC) — every CJK language in one 20 MB+ TrueType Collection. gpdf does not select a face index inside a ",[42,1117,1118],{},".ttc","; you'd need to slice out the JP face first with ",[42,1121,895],{}," and register the result. Skip the Super OTC.",[881,1124,1125,1128,1129,1132],{},[22,1126,1127],{},"Region-specific OTF"," (e.g. ",[42,1130,1131],{},"SourceHanSans-Regular.otf",") — all CJK scripts unified, CFF outlines. Not readable by gpdf.",[881,1134,1135,896,1138,1140,1141,1143],{},[22,1136,1137],{},"Language-specific TTF",[42,1139,44],{},") — JP-only, ",[42,1142,849],{}," outlines. This is the one to grab.",[18,1145,1146,1147,1149,1150,1153,1154,1157],{},"If your document mixes Japanese with Korean or Chinese in the same page, register language-specific families side by side: ",[42,1148,362],{}," plus ",[42,1151,1152],{},"SourceHanSansKR",". Switch explicitly with ",[42,1155,1156],{},"template.FontFamily"," where the text changes script. Reaching for the pan-CJK unified OTF would have fixed this with Han unification, but that introduces its own surprises for readers who expect JP-shaped kanji in JP text.",[13,1159,1161],{"id":1160},"when-to-pick-source-han-over-noto","When to pick Source Han over Noto",[18,1163,1164],{},"Same outlines, different distribution. Source Han Sans JP makes sense when:",[1108,1166,1167,1170,1177],{},[881,1168,1169],{},"Your ops team prefers pinning to Adobe's GitHub release tags for reproducibility",[881,1171,1172,1173,1176],{},"You already mirror ",[42,1174,1175],{},"github.com/adobe-fonts"," internally (common at enterprises with locked-down artifact policies)",[881,1178,1179],{},"The pan-CJK OTC bundle is useful elsewhere in your pipeline — a desktop publishing step, a DTP handoff, a brand system that standardizes on the Adobe name",[18,1181,1182],{},"Noto Sans JP is the better pick when:",[1108,1184,1185,1192,1195],{},[881,1186,1187,1188,1191],{},"You want the shortest route to a TTF (",[42,1189,1190],{},"https://fonts.google.com/noto/specimen/Noto+Sans+JP"," → zip → done)",[881,1193,1194],{},"Converting OTF to TTF isn't something you want in your build",[881,1196,1197],{},"Your project already pulls other Google Fonts via an existing workflow",[18,1199,1200],{},"The rendered PDF looks the same either way. The decision is operational — where the file lives, how you version it, how ops feels about it — not aesthetic.",[13,1202,1204],{"id":1203},"related-reading","Related reading",[1108,1206,1207,1213,1220,1227],{},[881,1208,1209,1212],{},[27,1210,1211],{"href":829},"How do I use Noto Sans JP with gpdf?"," — the same glyphs, published as TTF out of the box",[881,1214,1215,1219],{},[27,1216,1218],{"href":1217},"/blog/embed-japanese-font","How do I embed a Japanese font in gpdf?"," — the general CJK embedding recipe",[881,1221,1222,1226],{},[27,1223,1225],{"href":1224},"/blog/ipaex-gothic-gpdf","How do I use IPAex Gothic in gpdf?"," — the IPA-licensed alternative for Japanese institutional submissions",[881,1228,1229,1233],{},[27,1230,1232],{"href":1231},"/blog/tofu-boxes-japanese","Why does my PDF show tofu boxes for Japanese?"," — troubleshooting missing glyphs",[13,1235,1237],{"id":1236},"try-gpdf","Try gpdf",[18,1239,1240],{},"gpdf is a Go library for generating PDFs. MIT licensed, zero external dependencies, native CJK support.",[61,1242,1246],{"className":1243,"code":1244,"language":1245,"meta":66,"style":66},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","go get github.com/gpdf-dev/gpdf\n","bash",[42,1247,1248],{"__ignoreMap":66},[70,1249,1250,1252,1255],{"class":72,"line":73},[70,1251,65],{"class":80},[70,1253,1254],{"class":216}," get",[70,1256,1257],{"class":216}," github.com/gpdf-dev/gpdf\n",[18,1259,1260,1264,1265],{},[27,1261,1263],{"href":29,"rel":1262},[31],"⭐ Star on GitHub"," · ",[27,1266,1269],{"href":1267,"rel":1268},"https://gpdf.dev/docs/quickstart",[31],"Read the docs",[1271,1272,1273],"style",{},"html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":66,"searchDepth":84,"depth":84,"links":1275},[1276,1277,1278,1279,1280,1281,1282,1283,1284,1285],{"id":15,"depth":84,"text":16},{"id":36,"depth":84,"text":37},{"id":58,"depth":84,"text":59},{"id":724,"depth":84,"text":725},{"id":834,"depth":84,"text":835},{"id":912,"depth":84,"text":913},{"id":1102,"depth":84,"text":1103},{"id":1160,"depth":84,"text":1161},{"id":1203,"depth":84,"text":1204},{"id":1236,"depth":84,"text":1237},"2026-04-19","Register the TTF variant of Source Han Sans JP from Adobe's GitHub release with gpdf.WithFont. Seven weights, SIL OFL, same glyphs as Noto Sans JP.",false,"md",{"name":1291,"totalTime":1292,"tools":1293,"steps":1296},"Use Source Han Sans JP as the default font in a gpdf document","PT15M",[1294,1295],"Go 1.22+","SourceHanSansJP-Regular.ttf from adobe-fonts/source-han-sans",[1297,1300,1303,1306,1309],{"name":1298,"text":1299},"Grab the TTF variant from Adobe's GitHub release","Open github.com/adobe-fonts/source-han-sans/releases. From the latest release, download the TTF bundle (not the OTF or SuperOTC) and extract SourceHanSansJP-Regular.ttf. gpdf parses TrueType, not CFF-flavored OpenType.",{"name":1301,"text":1302},"Load the bytes at startup","Use os.ReadFile(\"SourceHanSansJP-Regular.ttf\") or //go:embed. Pin a specific Adobe release tag in your build so CI reproduces the same glyph table next month.",{"name":1304,"text":1305},"Register the font at document construction","Pass gpdf.WithFont(\"SourceHanSansJP\", fontBytes) and gpdf.WithDefaultFont(\"SourceHanSansJP\", 11) to gpdf.NewDocument. No AddUTF8Font, no filesystem path.",{"name":1307,"text":1308},"Register extra weights if you need them","Source Han Sans JP ships seven weights from ExtraLight to Heavy. Register the Bold TTF under SourceHanSansJP-Bold and template.Bold() picks up the real bold outlines instead of a synthesized stroke.",{"name":1310,"text":1311},"Keep OFL.txt with your distribution","SIL OFL 1.1 requires the license text to ship alongside the font binary. If you //go:embed the TTF, embed OFL.txt into LICENSES/ and reference it from NOTICE.",null,{},"/blog/source-han-sans-jp-with-gpdf",{"title":5,"description":1287},"blog/010.source-han-sans-jp-with-gpdf",[1318,1319,1320],"recipe","cjk","tutorial","SjEMReiHZOFtUnPHf3_FucnLBh9kNhBYWCfd-rKdfS4",1776537628930]