jetpack-fonts.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. <?php
  2. add_filter( 'typekit_add_font_category_rules', function( $category_rules ) {
  3. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  4. 'html',
  5. array(
  6. array( 'property' => 'font-family', 'value' => 'sans-serif' ),
  7. )
  8. );
  9. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  10. 'b,
  11. strong',
  12. array(
  13. array( 'property' => 'font-weight', 'value' => 'bold' ),
  14. )
  15. );
  16. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  17. 'dfn',
  18. array(
  19. array( 'property' => 'font-style', 'value' => 'italic' ),
  20. )
  21. );
  22. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  23. 'small',
  24. array(
  25. array( 'property' => 'font-size', 'value' => '13px' ),
  26. )
  27. );
  28. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  29. 'sub,
  30. sup',
  31. array(
  32. array( 'property' => 'font-size', 'value' => '75%' ),
  33. )
  34. );
  35. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  36. 'code,
  37. kbd,
  38. samp',
  39. array(
  40. array( 'property' => 'font-family', 'value' => 'monospace, monospace' ),
  41. array( 'property' => 'font-size', 'value' => '1em' ),
  42. )
  43. );
  44. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  45. 'pre',
  46. array(
  47. array( 'property' => 'font-family', 'value' => 'monospace, monospace' ),
  48. array( 'property' => 'font-size', 'value' => '1em' ),
  49. )
  50. );
  51. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  52. 'button,
  53. input,
  54. optgroup,
  55. select,
  56. textarea',
  57. array(
  58. array( 'property' => 'font', 'value' => 'inherit' ),
  59. )
  60. );
  61. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  62. 'optgroup',
  63. array(
  64. array( 'property' => 'font-weight', 'value' => 'bold' ),
  65. )
  66. );
  67. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  68. 'body,
  69. button,
  70. input,
  71. select,
  72. textarea',
  73. array(
  74. array( 'property' => 'font-family', 'value' => '"Libre Baskerville", Libre, Georgia, Times, serif' ),
  75. array( 'property' => 'font-size', 'value' => '18px' ),
  76. )
  77. );
  78. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  79. 'h1,
  80. h2,
  81. h3,
  82. h4,
  83. h5,
  84. h6,
  85. .site-title',
  86. array(
  87. array( 'property' => 'font-family', 'value' => '"Libre Baskerville", Libre, Georgia, Times, serif' ),
  88. array( 'property' => 'font-weight', 'value' => 'bold' ),
  89. )
  90. );
  91. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  92. 'h1',
  93. array(
  94. array( 'property' => 'font-size', 'value' => '29px' ),
  95. )
  96. );
  97. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  98. 'h2',
  99. array(
  100. array( 'property' => 'font-size', 'value' => '23px' ),
  101. )
  102. );
  103. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  104. 'h3',
  105. array(
  106. array( 'property' => 'font-size', 'value' => '18px' ),
  107. )
  108. );
  109. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  110. 'h4',
  111. array(
  112. array( 'property' => 'font-size', 'value' => '14px' ),
  113. )
  114. );
  115. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  116. 'h5',
  117. array(
  118. array( 'property' => 'font-size', 'value' => '13px' ),
  119. )
  120. );
  121. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  122. 'h6',
  123. array(
  124. array( 'property' => 'font-size', 'value' => '12px' ),
  125. )
  126. );
  127. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  128. 'cite,
  129. dfn,
  130. em,
  131. i',
  132. array(
  133. array( 'property' => 'font-style', 'value' => 'italic' ),
  134. )
  135. );
  136. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  137. 'blockquote',
  138. array(
  139. array( 'property' => 'font-size', 'value' => '18px' ),
  140. )
  141. );
  142. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  143. 'pre',
  144. array(
  145. array( 'property' => 'font-family', 'value' => '"Libre Baskerville", Libre, Georgia, Times, serif' ),
  146. )
  147. );
  148. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  149. 'code,
  150. kbd,
  151. tt,
  152. var',
  153. array(
  154. array( 'property' => 'font-family', 'value' => 'Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace' ),
  155. array( 'property' => 'font-size', 'value' => '16px' ),
  156. )
  157. );
  158. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  159. 'big',
  160. array(
  161. array( 'property' => 'font-size', 'value' => '125%' ),
  162. )
  163. );
  164. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  165. 'blockquote:before',
  166. array(
  167. array( 'property' => 'font-size', 'value' => '72px' ),
  168. )
  169. );
  170. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  171. '.comments-area blockquote',
  172. array(
  173. array( 'property' => 'font-size', 'value' => '18px' ),
  174. )
  175. );
  176. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  177. '.intro',
  178. array(
  179. array( 'property' => 'font-style', 'value' => 'italic' ),
  180. array( 'property' => 'font-size', 'value' => '23px' ),
  181. )
  182. );
  183. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  184. 'dt',
  185. array(
  186. array( 'property' => 'font-weight', 'value' => 'bold' ),
  187. )
  188. );
  189. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  190. 'caption',
  191. array(
  192. array( 'property' => 'font-weight', 'value' => 'bold' ),
  193. )
  194. );
  195. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  196. 'label',
  197. array(
  198. array( 'property' => 'font-style', 'value' => 'italic' ),
  199. )
  200. );
  201. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  202. '#infinite-handle span,
  203. button,
  204. input[type="button"],
  205. input[type="reset"],
  206. input[type="submit"]',
  207. array(
  208. array( 'property' => 'font-size', 'value' => '14px' ),
  209. array( 'property' => 'font-weight', 'value' => 'bold' ),
  210. )
  211. );
  212. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  213. 'input[type="email"],
  214. input[type="password"],
  215. input[type="search"],
  216. input[type="text"],
  217. input[type="url"]',
  218. array(
  219. array( 'property' => 'font-size', 'value' => '14px' ),
  220. )
  221. );
  222. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  223. '.singular .site-title',
  224. array(
  225. array( 'property' => 'font-size', 'value' => '29px' ),
  226. )
  227. );
  228. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  229. '.site-description',
  230. array(
  231. array( 'property' => 'font-style', 'value' => 'italic' ),
  232. )
  233. );
  234. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  235. '.entry-title',
  236. array(
  237. array( 'property' => 'font-size', 'value' => '29px' ),
  238. )
  239. );
  240. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  241. '.entry-footer,
  242. .entry-meta',
  243. array(
  244. array( 'property' => 'font-size', 'value' => '14px' ),
  245. array( 'property' => 'font-style', 'value' => 'italic' ),
  246. )
  247. );
  248. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  249. '.more-link',
  250. array(
  251. array( 'property' => 'font-style', 'value' => 'italic' ),
  252. )
  253. );
  254. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  255. '.page-title',
  256. array(
  257. array( 'property' => 'font-size', 'value' => '29px' ),
  258. )
  259. );
  260. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  261. '.site-footer',
  262. array(
  263. array( 'property' => 'font-size', 'value' => '14px' ),
  264. )
  265. );
  266. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  267. '.site-info',
  268. array(
  269. array( 'property' => 'font-style', 'value' => 'italic' ),
  270. )
  271. );
  272. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  273. '.main-navigation',
  274. array(
  275. array( 'property' => 'font-size', 'value' => '14px' ),
  276. )
  277. );
  278. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  279. '.site-main .comment-navigation,
  280. .site-main .post-navigation,
  281. .site-main .posts-navigation',
  282. array(
  283. array( 'property' => 'font-weight', 'value' => 'bold' ),
  284. )
  285. );
  286. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  287. '.site-main .post-navigation',
  288. array(
  289. array( 'property' => 'font-size', 'value' => '23px' ),
  290. )
  291. );
  292. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  293. '.comment-navigation .meta-nav,
  294. .post-navigation .meta-nav,
  295. .posts-navigation .meta-nav',
  296. array(
  297. array( 'property' => 'font-size', 'value' => '14px' ),
  298. array( 'property' => 'font-style', 'value' => 'italic' ),
  299. array( 'property' => 'font-weight', 'value' => 'normal' ),
  300. )
  301. );
  302. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  303. '.screen-reader-text:focus',
  304. array(
  305. array( 'property' => 'font-size', 'value' => '14px' ),
  306. array( 'property' => 'font-size', 'value' => '0.875rem' ),
  307. array( 'property' => 'font-weight', 'value' => 'bold' ),
  308. )
  309. );
  310. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  311. '.widget',
  312. array(
  313. array( 'property' => 'font-size', 'value' => '14px' ),
  314. )
  315. );
  316. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  317. '.widget-title,
  318. .widgettitle',
  319. array(
  320. array( 'property' => 'font-size', 'value' => '18px' ),
  321. )
  322. );
  323. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  324. '.widget_calendar th',
  325. array(
  326. array( 'property' => 'font-weight', 'value' => 'bold' ),
  327. )
  328. );
  329. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  330. 'td#prev',
  331. array(
  332. array( 'property' => 'font-style', 'value' => 'italic' ),
  333. )
  334. );
  335. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  336. 'td#next',
  337. array(
  338. array( 'property' => 'font-style', 'value' => 'italic' ),
  339. )
  340. );
  341. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  342. '.widget_recent_comments a',
  343. array(
  344. array( 'property' => 'font-style', 'value' => 'italic' ),
  345. )
  346. );
  347. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  348. '.widget_recent_comments .comment-author-link,
  349. .widget_recent_comments .comment-author-link a',
  350. array(
  351. array( 'property' => 'font-style', 'value' => 'normal' ),
  352. array( 'property' => 'font-weight', 'value' => 'bold' ),
  353. )
  354. );
  355. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  356. '.rsswidget',
  357. array(
  358. array( 'property' => 'font-weight', 'value' => 'bold' ),
  359. )
  360. );
  361. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  362. '.rss-date',
  363. array(
  364. array( 'property' => 'font-style', 'value' => 'italic' ),
  365. )
  366. );
  367. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  368. '.comment-meta',
  369. array(
  370. array( 'property' => 'font-size', 'value' => '14px' ),
  371. array( 'property' => 'font-style', 'value' => 'italic' ),
  372. )
  373. );
  374. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  375. '.comment-author',
  376. array(
  377. array( 'property' => 'font-size', 'value' => '18px' ),
  378. array( 'property' => 'font-style', 'value' => 'normal' ),
  379. array( 'property' => 'font-weight', 'value' => 'bold' ),
  380. )
  381. );
  382. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  383. '.no-comments',
  384. array(
  385. array( 'property' => 'font-size', 'value' => '14px' ),
  386. array( 'property' => 'font-style', 'value' => 'italic' ),
  387. )
  388. );
  389. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  390. '#infinite-footer .blog-credits',
  391. array(
  392. array( 'property' => 'font-size', 'value' => '14px' ),
  393. array( 'property' => 'font-style', 'value' => 'italic' ),
  394. )
  395. );
  396. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  397. '#infinite-handle span',
  398. array(
  399. array( 'property' => 'font-size', 'value' => '18px' ),
  400. )
  401. );
  402. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  403. '.wp-caption-text',
  404. array(
  405. array( 'property' => 'font-size', 'value' => '14px' ),
  406. array( 'property' => 'font-style', 'value' => 'italic' ),
  407. )
  408. );
  409. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  410. '.wp-caption-text:before',
  411. array(
  412. array( 'property' => 'font-style', 'value' => 'normal' ),
  413. )
  414. );
  415. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  416. '.main-navigation ul > li.menu-item-has-children > a:after,
  417. .main-navigation ul > li.page_item_has_children > a:after',
  418. array(
  419. array( 'property' => 'font-size', 'value' => '23px' ),
  420. ),
  421. array(
  422. 'screen and ( min-width: 45em )',
  423. )
  424. );
  425. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  426. '.singular .entry-title,
  427. h1',
  428. array(
  429. array( 'property' => 'font-size', 'value' => '47px' ),
  430. ),
  431. array(
  432. 'screen and ( min-width: 45em )',
  433. )
  434. );
  435. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  436. 'h2',
  437. array(
  438. array( 'property' => 'font-size', 'value' => '29px' ),
  439. ),
  440. array(
  441. 'screen and ( min-width: 45em )',
  442. )
  443. );
  444. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  445. 'h3',
  446. array(
  447. array( 'property' => 'font-size', 'value' => '23px' ),
  448. ),
  449. array(
  450. 'screen and ( min-width: 45em )',
  451. )
  452. );
  453. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  454. 'h4',
  455. array(
  456. array( 'property' => 'font-size', 'value' => '18px' ),
  457. ),
  458. array(
  459. 'screen and ( min-width: 45em )',
  460. )
  461. );
  462. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  463. 'h5',
  464. array(
  465. array( 'property' => 'font-size', 'value' => '14px' ),
  466. ),
  467. array(
  468. 'screen and ( min-width: 45em )',
  469. )
  470. );
  471. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  472. 'h6',
  473. array(
  474. array( 'property' => 'font-size', 'value' => '13px' ),
  475. ),
  476. array(
  477. 'screen and ( min-width: 45em )',
  478. )
  479. );
  480. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  481. 'blockquote',
  482. array(
  483. array( 'property' => 'font-size', 'value' => '23px' ),
  484. ),
  485. array(
  486. 'screen and ( min-width: 45em )',
  487. )
  488. );
  489. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  490. 'blockquote:before',
  491. array(
  492. array( 'property' => 'font-size', 'value' => '123px' ),
  493. ),
  494. array(
  495. 'screen and ( min-width: 45em )',
  496. )
  497. );
  498. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  499. '.sticking .site-title',
  500. array(
  501. array( 'property' => 'font-size', 'value' => '18px' ),
  502. ),
  503. array(
  504. 'screen and ( min-width: 45em )',
  505. )
  506. );
  507. return $category_rules;
  508. } );