1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

Include Source Sans on-demand with Celerity

Summary:
Unwinds the mess I made in D8422 / D8430:

  - Remove `'fonts'`, since individual fonts can be included via Celerity now.
  - Include Source Sans from the local source when a document uses it as a fontkit.

Test Plan: Browsed Diviner, saw Source Sans.

Reviewers: chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D8431
This commit is contained in:
epriestley 2014-03-06 11:39:48 -08:00
parent 81d9935efe
commit 270929dd6b
6 changed files with 7 additions and 27 deletions

View file

@ -222,10 +222,6 @@ abstract class PhabricatorController extends AphrontController {
$page->setDeviceReady(true);
}
if (idx($options, 'fonts')) {
$page->setExtraFonts(true);
}
$page->setShowChrome(idx($options, 'chrome', true));
$application_menu = $this->buildApplicationMenu();

View file

@ -249,7 +249,6 @@ final class DivinerAtomController extends DivinerController {
array(
'title' => $symbol->getTitle(),
'device' => true,
'fonts' => true,
));
}

View file

@ -92,7 +92,6 @@ final class DivinerBookController extends DivinerController {
array(
'title' => $book->getTitle(),
'device' => true,
'fonts' => true,
));
}

View file

@ -86,7 +86,6 @@ final class DivinerFindController extends DivinerController {
array(
'title' => array(pht('Find'), pht('"%s"', $query_text)),
'device' => true,
'fonts' => true,
));
}

View file

@ -12,7 +12,6 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
private $glyph;
private $menuContent;
private $showChrome = true;
private $extraFonts;
private $disableConsole;
private $pageObjects = array();
private $applicationMenu;
@ -58,15 +57,6 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
return $this->showChrome;
}
public function setExtraFonts($extra) {
$this->extraFonts = $extra;
return $this;
}
public function getExtraFonts() {
return $this->extraFonts;
}
public function appendPageObjects(array $objs) {
foreach ($objs as $obj) {
$this->pageObjects[] = $obj;
@ -243,16 +233,8 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
$response = CelerityAPI::getStaticResourceResponse();
$fonts = null;
if ($this->getExtraFonts()) {
$fonts = hsprintf("<link
href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700'
rel='stylesheet'
type='text/css'>");
}
return hsprintf(
'%s%s<style type="text/css">'.
'%s<style type="text/css">'.
'.PhabricatorMonospaced, '.
'.phabricator-remarkup .remarkup-code-block { font: %s; } '.
'.platform-windows .PhabricatorMonospaced, '.
@ -260,7 +242,6 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
'.remarkup-code-block { font: %s; }'.
'</style>%s',
parent::getHead(),
$fonts,
phutil_safe_html($monospaced),
phutil_safe_html($monospaced_win),
$response->renderSingleResource('javelin-magical-init', 'phabricator'));

View file

@ -75,6 +75,12 @@ final class PHUIDocumentView extends AphrontTagView {
require_celerity_resource('phui-fontkit-css');
}
switch ($this->fontKit) {
case self::FONT_SOURCE_SANS:
require_celerity_resource('font-source-sans-pro');
break;
}
$classes = array();
$classes[] = 'phui-document-view';
if ($this->offset) {