mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 09:12:41 +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:
parent
81d9935efe
commit
270929dd6b
6 changed files with 7 additions and 27 deletions
|
@ -222,10 +222,6 @@ abstract class PhabricatorController extends AphrontController {
|
||||||
$page->setDeviceReady(true);
|
$page->setDeviceReady(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idx($options, 'fonts')) {
|
|
||||||
$page->setExtraFonts(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$page->setShowChrome(idx($options, 'chrome', true));
|
$page->setShowChrome(idx($options, 'chrome', true));
|
||||||
|
|
||||||
$application_menu = $this->buildApplicationMenu();
|
$application_menu = $this->buildApplicationMenu();
|
||||||
|
|
|
@ -249,7 +249,6 @@ final class DivinerAtomController extends DivinerController {
|
||||||
array(
|
array(
|
||||||
'title' => $symbol->getTitle(),
|
'title' => $symbol->getTitle(),
|
||||||
'device' => true,
|
'device' => true,
|
||||||
'fonts' => true,
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,6 @@ final class DivinerBookController extends DivinerController {
|
||||||
array(
|
array(
|
||||||
'title' => $book->getTitle(),
|
'title' => $book->getTitle(),
|
||||||
'device' => true,
|
'device' => true,
|
||||||
'fonts' => true,
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,6 @@ final class DivinerFindController extends DivinerController {
|
||||||
array(
|
array(
|
||||||
'title' => array(pht('Find'), pht('"%s"', $query_text)),
|
'title' => array(pht('Find'), pht('"%s"', $query_text)),
|
||||||
'device' => true,
|
'device' => true,
|
||||||
'fonts' => true,
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
|
||||||
private $glyph;
|
private $glyph;
|
||||||
private $menuContent;
|
private $menuContent;
|
||||||
private $showChrome = true;
|
private $showChrome = true;
|
||||||
private $extraFonts;
|
|
||||||
private $disableConsole;
|
private $disableConsole;
|
||||||
private $pageObjects = array();
|
private $pageObjects = array();
|
||||||
private $applicationMenu;
|
private $applicationMenu;
|
||||||
|
@ -58,15 +57,6 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
|
||||||
return $this->showChrome;
|
return $this->showChrome;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setExtraFonts($extra) {
|
|
||||||
$this->extraFonts = $extra;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getExtraFonts() {
|
|
||||||
return $this->extraFonts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function appendPageObjects(array $objs) {
|
public function appendPageObjects(array $objs) {
|
||||||
foreach ($objs as $obj) {
|
foreach ($objs as $obj) {
|
||||||
$this->pageObjects[] = $obj;
|
$this->pageObjects[] = $obj;
|
||||||
|
@ -243,16 +233,8 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
|
||||||
|
|
||||||
$response = CelerityAPI::getStaticResourceResponse();
|
$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(
|
return hsprintf(
|
||||||
'%s%s<style type="text/css">'.
|
'%s<style type="text/css">'.
|
||||||
'.PhabricatorMonospaced, '.
|
'.PhabricatorMonospaced, '.
|
||||||
'.phabricator-remarkup .remarkup-code-block { font: %s; } '.
|
'.phabricator-remarkup .remarkup-code-block { font: %s; } '.
|
||||||
'.platform-windows .PhabricatorMonospaced, '.
|
'.platform-windows .PhabricatorMonospaced, '.
|
||||||
|
@ -260,7 +242,6 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
|
||||||
'.remarkup-code-block { font: %s; }'.
|
'.remarkup-code-block { font: %s; }'.
|
||||||
'</style>%s',
|
'</style>%s',
|
||||||
parent::getHead(),
|
parent::getHead(),
|
||||||
$fonts,
|
|
||||||
phutil_safe_html($monospaced),
|
phutil_safe_html($monospaced),
|
||||||
phutil_safe_html($monospaced_win),
|
phutil_safe_html($monospaced_win),
|
||||||
$response->renderSingleResource('javelin-magical-init', 'phabricator'));
|
$response->renderSingleResource('javelin-magical-init', 'phabricator'));
|
||||||
|
|
|
@ -75,6 +75,12 @@ final class PHUIDocumentView extends AphrontTagView {
|
||||||
require_celerity_resource('phui-fontkit-css');
|
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 = array();
|
||||||
$classes[] = 'phui-document-view';
|
$classes[] = 'phui-document-view';
|
||||||
if ($this->offset) {
|
if ($this->offset) {
|
||||||
|
|
Loading…
Reference in a new issue