jetpack-fonts.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. <?php
  2. add_filter( 'typekit_add_font_category_rules', function( $category_rules ) {
  3. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  4. 'h1',
  5. array(
  6. array( 'property' => 'font-size', 'value' => '2em' ),
  7. )
  8. );
  9. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  10. 'b,
  11. strong',
  12. array(
  13. array( 'property' => 'font-weight', 'value' => 'bolder' ),
  14. )
  15. );
  16. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  17. 'small',
  18. array(
  19. array( 'property' => 'font-size', 'value' => '80%' ),
  20. )
  21. );
  22. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  23. 'sub,
  24. sup',
  25. array(
  26. array( 'property' => 'font-size', 'value' => '75%' ),
  27. )
  28. );
  29. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  30. 'button,
  31. input,
  32. optgroup,
  33. select,
  34. textarea',
  35. array(
  36. array( 'property' => 'font-family', 'value' => 'inherit' ),
  37. array( 'property' => 'font-size', 'value' => '100%' ),
  38. )
  39. );
  40. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  41. '::-webkit-file-upload-button',
  42. array(
  43. array( 'property' => 'font', 'value' => 'inherit' ),
  44. )
  45. );
  46. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  47. 'html',
  48. array(
  49. array( 'property' => 'font-size', 'value' => '62.5%' ),
  50. )
  51. );
  52. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  53. 'body,
  54. button,
  55. input,
  56. optgroup,
  57. select,
  58. textarea',
  59. array(
  60. array( 'property' => 'font-family', 'value' => '-apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif' ),
  61. array( 'property' => 'font-size', 'value' => '16px' ),
  62. array( 'property' => 'font-size', 'value' => '1.6rem' ),
  63. )
  64. );
  65. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  66. 'h1,
  67. h2,
  68. h3,
  69. h4,
  70. h5,
  71. h6',
  72. array(
  73. array( 'property' => 'font-family', 'value' => '-apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif' ),
  74. )
  75. );
  76. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  77. 'cite,
  78. dfn,
  79. em,
  80. i',
  81. array(
  82. array( 'property' => 'font-style', 'value' => 'italic' ),
  83. )
  84. );
  85. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  86. 'blockquote',
  87. array(
  88. array( 'property' => 'font-style', 'value' => 'italic' ),
  89. )
  90. );
  91. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  92. 'blockquote cite',
  93. array(
  94. array( 'property' => 'font-style', 'value' => 'normal' ),
  95. array( 'property' => 'font-weight', 'value' => 'bold' ),
  96. )
  97. );
  98. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  99. 'big',
  100. array(
  101. array( 'property' => 'font-size', 'value' => '125%' ),
  102. )
  103. );
  104. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  105. 'dt',
  106. array(
  107. array( 'property' => 'font-weight', 'value' => 'bold' ),
  108. )
  109. );
  110. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  111. 'caption,
  112. th',
  113. array(
  114. array( 'property' => 'font-weight', 'value' => 'bold' ),
  115. )
  116. );
  117. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  118. 'button,
  119. input[type="button"],
  120. input[type="reset"],
  121. input[type="submit"]',
  122. array(
  123. array( 'property' => 'font-size', 'value' => '15px' ),
  124. array( 'property' => 'font-size', 'value' => '1.5rem' ),
  125. )
  126. );
  127. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  128. '.required',
  129. array(
  130. array( 'property' => 'font-weight', 'value' => 'bold' ),
  131. )
  132. );
  133. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  134. '.nav-links .nav-meta',
  135. array(
  136. array( 'property' => 'font-size', 'value' => '14px' ),
  137. array( 'property' => 'font-size', 'value' => '1.4rem' ),
  138. array( 'property' => 'font-weight', 'value' => '100' ),
  139. )
  140. );
  141. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  142. '.nav-links a',
  143. array(
  144. array( 'property' => 'font-family', 'value' => '-apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif' ),
  145. array( 'property' => 'font-weight', 'value' => 'bold' ),
  146. array( 'property' => 'font-size', 'value' => '18px' ),
  147. array( 'property' => 'font-size', 'value' => '1.8rem' ),
  148. )
  149. );
  150. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  151. '.nav-links .current',
  152. array(
  153. array( 'property' => 'font-weight', 'value' => 'bold' ),
  154. )
  155. );
  156. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  157. '.screen-reader-text:focus',
  158. array(
  159. array( 'property' => 'font-size', 'value' => '16px' ),
  160. array( 'property' => 'font-size', 'value' => '1.6rem' ),
  161. array( 'property' => 'font-weight', 'value' => 'bold' ),
  162. )
  163. );
  164. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  165. '.widget-title',
  166. array(
  167. array( 'property' => 'font-size', 'value' => '16px' ),
  168. array( 'property' => 'font-weight', 'value' => 'bold' ),
  169. )
  170. );
  171. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  172. '.widget_calendar a',
  173. array(
  174. array( 'property' => 'font-weight', 'value' => 'bold' ),
  175. )
  176. );
  177. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  178. '.widget_goodreads h2[class^="gr_custom_header_"]',
  179. array(
  180. array( 'property' => 'font-size', 'value' => '2rem' ),
  181. )
  182. );
  183. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  184. '.widget_blog_subscription input[type="submit"]',
  185. array(
  186. array( 'property' => 'font-size', 'value' => '1.6rem' ),
  187. array( 'property' => 'font-weight', 'value' => 'bold' ),
  188. )
  189. );
  190. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  191. '.entry-title,
  192. .page-title',
  193. array(
  194. array( 'property' => 'font-family', 'value' => '-apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif' ),
  195. array( 'property' => 'font-size', 'value' => '28px' ),
  196. )
  197. );
  198. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  199. '.entry-content h1,
  200. .page-content h1',
  201. array(
  202. array( 'property' => 'font-size', 'value' => '34px' ),
  203. )
  204. );
  205. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  206. '.entry-content h2,
  207. .page-content h2',
  208. array(
  209. array( 'property' => 'font-size', 'value' => '28px' ),
  210. )
  211. );
  212. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  213. '.entry-content h3,
  214. .page-content h3',
  215. array(
  216. array( 'property' => 'font-size', 'value' => '24px' ),
  217. )
  218. );
  219. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  220. '.entry-content h4,
  221. .page-content h4',
  222. array(
  223. array( 'property' => 'font-size', 'value' => '20px' ),
  224. )
  225. );
  226. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  227. '.entry-content h5,
  228. .page-content h5',
  229. array(
  230. array( 'property' => 'font-size', 'value' => '16px' ),
  231. )
  232. );
  233. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  234. '.entry-content h6,
  235. .page-content h6',
  236. array(
  237. array( 'property' => 'font-size', 'value' => '14px' ),
  238. )
  239. );
  240. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  241. '.entry-footer',
  242. array(
  243. array( 'property' => 'font-size', 'value' => '14px' ),
  244. array( 'property' => 'font-size', 'value' => '1.4rem' ),
  245. array( 'property' => 'font-weight', 'value' => '100' ),
  246. )
  247. );
  248. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  249. '.entry-footer span a',
  250. array(
  251. array( 'property' => 'font-weight', 'value' => 'bold' ),
  252. )
  253. );
  254. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  255. '.page-links',
  256. array(
  257. array( 'property' => 'font-size', 'value' => '14px' ),
  258. )
  259. );
  260. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  261. '.page-links .page-number',
  262. array(
  263. array( 'property' => 'font-weight', 'value' => 'bold' ),
  264. )
  265. );
  266. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  267. '.comments-title',
  268. array(
  269. array( 'property' => 'font-size', 'value' => '2rem' ),
  270. )
  271. );
  272. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  273. '.comment-meta',
  274. array(
  275. array( 'property' => 'font-size', 'value' => '1.4rem' ),
  276. )
  277. );
  278. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  279. '.comment-metadata',
  280. array(
  281. array( 'property' => 'font-weight', 'value' => '100' ),
  282. )
  283. );
  284. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  285. '.comment-body .comment-edit-link',
  286. array(
  287. array( 'property' => 'font-size', 'value' => '1.7rem' ),
  288. array( 'property' => 'font-weight', 'value' => 'normal' ),
  289. )
  290. );
  291. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  292. '.comment-reply-link',
  293. array(
  294. array( 'property' => 'font-size', 'value' => '14px' ),
  295. array( 'property' => 'font-size', 'value' => '1.4rem' ),
  296. array( 'property' => 'font-weight', 'value' => 'bold' ),
  297. )
  298. );
  299. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  300. '.comment-form .submit',
  301. array(
  302. array( 'property' => 'font-size', 'value' => '17px' ),
  303. array( 'property' => 'font-weight', 'value' => 'bold' ),
  304. )
  305. );
  306. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  307. '.pingback .comment-body .url',
  308. array(
  309. array( 'property' => 'font-weight', 'value' => 'bold' ),
  310. )
  311. );
  312. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  313. '#infinite-handle span button,
  314. #infinite-handle span button:focus,
  315. #infinite-handle span button:hover',
  316. array(
  317. array( 'property' => 'font-size', 'value' => '16px' ),
  318. array( 'property' => 'font-weight', 'value' => 'bold' ),
  319. )
  320. );
  321. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  322. '.wp-caption-text',
  323. array(
  324. array( 'property' => 'font-size', 'value' => '0.8em' ),
  325. )
  326. );
  327. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  328. '.gallery-caption',
  329. array(
  330. array( 'property' => 'font-size', 'value' => '0.8em' ),
  331. )
  332. );
  333. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  334. '.site-title',
  335. array(
  336. array( 'property' => 'font-family', 'value' => '-apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif' ),
  337. array( 'property' => 'font-size', 'value' => '20px' ),
  338. array( 'property' => 'font-weight', 'value' => 'bold' ),
  339. )
  340. );
  341. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  342. '.site-info',
  343. array(
  344. array( 'property' => 'font-weight', 'value' => '100' ),
  345. array( 'property' => 'font-size', 'value' => '14px' ),
  346. )
  347. );
  348. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  349. '.site-footer .jetpack-social-navigation a',
  350. array(
  351. array( 'property' => 'font-size', 'value' => '24px' ),
  352. )
  353. );
  354. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  355. '.main-navigation .menu-toggle span',
  356. array(
  357. array( 'property' => 'font-size', 'value' => '14px' ),
  358. array( 'property' => 'font-size', 'value' => '1.4rem' ),
  359. array( 'property' => 'font-weight', 'value' => '600' ),
  360. ),
  361. array(
  362. 'screen and ( min-width: 658px )',
  363. )
  364. );
  365. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  366. '.site-title',
  367. array(
  368. array( 'property' => 'font-size', 'value' => '24px' ),
  369. ),
  370. array(
  371. 'screen and ( min-width: 658px )',
  372. )
  373. );
  374. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  375. '.site-description',
  376. array(
  377. array( 'property' => 'font-size', 'value' => '17px' ),
  378. array( 'property' => 'font-weight', 'value' => '100' ),
  379. ),
  380. array(
  381. 'screen and ( min-width: 658px )',
  382. )
  383. );
  384. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  385. '.main-navigation a',
  386. array(
  387. array( 'property' => 'font-weight', 'value' => 'bold' ),
  388. ),
  389. array(
  390. 'screen and ( min-width: 658px )',
  391. )
  392. );
  393. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  394. '.entry-title,
  395. .page-title',
  396. array(
  397. array( 'property' => 'font-size', 'value' => '42px' ),
  398. ),
  399. array(
  400. 'screen and ( min-width: 658px )',
  401. )
  402. );
  403. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  404. '.entry-content,
  405. .entry-summary,
  406. .page-content',
  407. array(
  408. array( 'property' => 'font-size', 'value' => '20px' ),
  409. ),
  410. array(
  411. 'screen and ( min-width: 658px )',
  412. )
  413. );
  414. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  415. '.entry-content h1,
  416. .page-content h1',
  417. array(
  418. array( 'property' => 'font-size', 'value' => '42px' ),
  419. ),
  420. array(
  421. 'screen and ( min-width: 658px )',
  422. )
  423. );
  424. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  425. '.entry-content h2,
  426. .page-content h2',
  427. array(
  428. array( 'property' => 'font-size', 'value' => '35px' ),
  429. ),
  430. array(
  431. 'screen and ( min-width: 658px )',
  432. )
  433. );
  434. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  435. '.entry-content h3,
  436. .page-content h3',
  437. array(
  438. array( 'property' => 'font-size', 'value' => '29px' ),
  439. ),
  440. array(
  441. 'screen and ( min-width: 658px )',
  442. )
  443. );
  444. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  445. '.entry-content h4,
  446. .page-content h4',
  447. array(
  448. array( 'property' => 'font-size', 'value' => '24px' ),
  449. ),
  450. array(
  451. 'screen and ( min-width: 658px )',
  452. )
  453. );
  454. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  455. '.entry-content h5,
  456. .page-content h5',
  457. array(
  458. array( 'property' => 'font-size', 'value' => '20px' ),
  459. ),
  460. array(
  461. 'screen and ( min-width: 658px )',
  462. )
  463. );
  464. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  465. '.entry-content h6,
  466. .page-content h6',
  467. array(
  468. array( 'property' => 'font-size', 'value' => '17px' ),
  469. ),
  470. array(
  471. 'screen and ( min-width: 658px )',
  472. )
  473. );
  474. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  475. '.entry-footer,
  476. .nav-links .nav-meta,
  477. .page-links',
  478. array(
  479. array( 'property' => 'font-size', 'value' => '17px' ),
  480. ),
  481. array(
  482. 'screen and ( min-width: 658px )',
  483. )
  484. );
  485. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  486. '.nav-links a',
  487. array(
  488. array( 'property' => 'font-size', 'value' => '24px' ),
  489. array( 'property' => 'font-size', 'value' => '2.4rem' ),
  490. ),
  491. array(
  492. 'screen and ( min-width: 658px )',
  493. )
  494. );
  495. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  496. '.nav-links .arrow a,
  497. .nav-links .page-numbers',
  498. array(
  499. array( 'property' => 'font-size', 'value' => '20px' ),
  500. array( 'property' => 'font-size', 'value' => '2rem' ),
  501. ),
  502. array(
  503. 'screen and ( min-width: 658px )',
  504. )
  505. );
  506. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  507. '.search-form .search-field',
  508. array(
  509. array( 'property' => 'font-size', 'value' => '20px' ),
  510. ),
  511. array(
  512. 'screen and ( min-width: 658px )',
  513. )
  514. );
  515. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  516. '.comment-reply-title,
  517. .comments-title,
  518. .no-comments',
  519. array(
  520. array( 'property' => 'font-size', 'value' => '2.4rem' ),
  521. array( 'property' => 'font-weight', 'value' => 'bold' ),
  522. ),
  523. array(
  524. 'screen and ( min-width: 658px )',
  525. )
  526. );
  527. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  528. '.comment-body',
  529. array(
  530. array( 'property' => 'font-size', 'value' => '2.0rem' ),
  531. ),
  532. array(
  533. 'screen and ( min-width: 658px )',
  534. )
  535. );
  536. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  537. '.comment-meta',
  538. array(
  539. array( 'property' => 'font-size', 'value' => '1.7rem' ),
  540. ),
  541. array(
  542. 'screen and ( min-width: 658px )',
  543. )
  544. );
  545. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  546. '.comment-reply-link',
  547. array(
  548. array( 'property' => 'font-size', 'value' => '1.7rem' ),
  549. ),
  550. array(
  551. 'screen and ( min-width: 658px )',
  552. )
  553. );
  554. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  555. '.widget,
  556. .widget .widget-title',
  557. array(
  558. array( 'property' => 'font-size', 'value' => '20px' ),
  559. ),
  560. array(
  561. 'screen and ( min-width: 658px )',
  562. )
  563. );
  564. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  565. '.site-footer .site-info',
  566. array(
  567. array( 'property' => 'font-size', 'value' => '17px' ),
  568. ),
  569. array(
  570. 'screen and ( min-width: 658px )',
  571. )
  572. );
  573. return $category_rules;
  574. } );