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