From 0a8eee37a10300036aef2e08071f0611ceeb37b8 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sat, 28 Feb 2015 14:37:31 -0800 Subject: [PATCH] Bump monospace font +1px when using Source Sans Pro Summary: This diff moves the default monospace font from a Global Default config value to CSS. What this will allow is some flexibility in changing this font in other areas (like Diviner and DocumentView) without changing the defaults globally. However if the admin sets a config value or a user sets a config value, that value will trump all settings in the CSS files with an !important declaration in the page head. Test Plan: Currently tested: - Setting no value - Setting an admin value - Setting a user value Verify remarkup blocks in Differential, Diviner, Conpherence, and Diffusion look as expected. Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11597 --- resources/celerity/map.php | 16 ++++----- ...ricatorSyntaxHighlightingConfigOptions.php | 4 +-- src/view/page/PhabricatorStandardPageView.php | 33 +++++++++++++------ .../differential/changeset-view.css | 1 - webroot/rsrc/css/core/remarkup.css | 15 +++++++++ webroot/rsrc/css/phui/phui-fontkit.css | 15 +++++++++ 6 files changed, 63 insertions(+), 21 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 1967b27ca6..fc31bcde3b 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,10 +7,10 @@ */ return array( 'names' => array( - 'core.pkg.css' => '3fa78a8d', + 'core.pkg.css' => 'dc3f102a', 'core.pkg.js' => '23d653bb', 'darkconsole.pkg.js' => '8ab24e01', - 'differential.pkg.css' => '14f0fa92', + 'differential.pkg.css' => '4c3242f8', 'differential.pkg.js' => '7b5a4aa4', 'diffusion.pkg.css' => '591664fa', 'diffusion.pkg.js' => 'bfc0737b', @@ -56,7 +56,7 @@ return array( 'rsrc/css/application/dashboard/dashboard.css' => 'c0062064', 'rsrc/css/application/diff/inline-comment-summary.css' => 'eb5f8e8c', 'rsrc/css/application/differential/add-comment.css' => 'c478bcaa', - 'rsrc/css/application/differential/changeset-view.css' => '8244e5a8', + 'rsrc/css/application/differential/changeset-view.css' => 'a7781046', 'rsrc/css/application/differential/core.css' => '7ac3cabc', 'rsrc/css/application/differential/results-table.css' => '181aa9d9', 'rsrc/css/application/differential/revision-comment.css' => '48186045', @@ -106,7 +106,7 @@ return array( 'rsrc/css/application/tokens/tokens.css' => '3d0f239e', 'rsrc/css/application/uiexample/example.css' => '528b19de', 'rsrc/css/core/core.css' => 'c8c5ecd2', - 'rsrc/css/core/remarkup.css' => '07f22227', + 'rsrc/css/core/remarkup.css' => '2dbff225', 'rsrc/css/core/syntax.css' => '56c1ba38', 'rsrc/css/core/z-index.css' => '8239495e', 'rsrc/css/diviner/diviner-shared.css' => '38813222', @@ -130,7 +130,7 @@ return array( 'rsrc/css/phui/phui-document.css' => '8240b0b1', 'rsrc/css/phui/phui-error-view.css' => '41518665', 'rsrc/css/phui/phui-feed-story.css' => 'c9f3a0b5', - 'rsrc/css/phui/phui-fontkit.css' => 'bd111278', + 'rsrc/css/phui/phui-fontkit.css' => '4394f216', 'rsrc/css/phui/phui-form-view.css' => '8b78a986', 'rsrc/css/phui/phui-form.css' => 'f535f938', 'rsrc/css/phui/phui-header-view.css' => '083669db', @@ -522,7 +522,7 @@ return array( 'conpherence-notification-css' => '04a6e10a', 'conpherence-update-css' => '1099a660', 'conpherence-widget-pane-css' => '3d575438', - 'differential-changeset-view-css' => '8244e5a8', + 'differential-changeset-view-css' => 'a7781046', 'differential-core-view-css' => '7ac3cabc', 'differential-inline-comment-editor' => 'f2441746', 'differential-results-table-css' => '181aa9d9', @@ -740,7 +740,7 @@ return array( 'phabricator-phtize' => 'd254d646', 'phabricator-prefab' => '72da38cc', 'phabricator-profile-css' => 'd8cb982b', - 'phabricator-remarkup-css' => '07f22227', + 'phabricator-remarkup-css' => '2dbff225', 'phabricator-search-results-css' => 'f240504c', 'phabricator-shaped-request' => '7cbe244b', 'phabricator-side-menu-view-css' => '7e8c6341', @@ -785,7 +785,7 @@ return array( 'phui-error-view-css' => '41518665', 'phui-feed-story-css' => 'c9f3a0b5', 'phui-font-icon-base-css' => '3dad2ae3', - 'phui-fontkit-css' => 'bd111278', + 'phui-fontkit-css' => '4394f216', 'phui-form-css' => 'f535f938', 'phui-form-view-css' => '8b78a986', 'phui-header-view-css' => '083669db', diff --git a/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php b/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php index cffb2a82bf..ab40f72898 100644 --- a/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php +++ b/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php @@ -140,7 +140,7 @@ final class PhabricatorSyntaxHighlightingConfigOptions $this->newOption( 'style.monospace', 'string', - '10px "Menlo", "Consolas", "Monaco", monospace') + null) ->setLocked(true) ->setSummary( pht('Default monospace font.')) @@ -151,7 +151,7 @@ final class PhabricatorSyntaxHighlightingConfigOptions $this->newOption( 'style.monospace.windows', 'string', - '11px "Menlo", "Consolas", "Monaco", monospace') + null) ->setLocked(true) ->setSummary( pht('Default monospace font for clients on Windows.')) diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index 415773e325..d3f558fd64 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -270,18 +270,31 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { $response = CelerityAPI::getStaticResourceResponse(); + $font_css = null; + if (!empty($monospaced)) { + $font_css = hsprintf( + '', $monospaced); + } + + $font_css_win = null; + if (!empty($monospaced_win)) { + $font_css_win = hsprintf( + '', $monospaced_win); + } + return hsprintf( - '%s%s', + '%s%s%s%s', parent::getHead(), - phutil_safe_html($monospaced), - phutil_safe_html($monospaced_win), + $font_css, + $font_css_win, $response->renderSingleResource('javelin-magical-init', 'phabricator')); } diff --git a/webroot/rsrc/css/application/differential/changeset-view.css b/webroot/rsrc/css/application/differential/changeset-view.css index 9dec1b7a19..27c48c7299 100644 --- a/webroot/rsrc/css/application/differential/changeset-view.css +++ b/webroot/rsrc/css/application/differential/changeset-view.css @@ -61,7 +61,6 @@ color: {$bluetext}; cursor: pointer; border-right: 1px solid {$thinblueborder}; - font-size: 11px; overflow: hidden; -moz-user-select: -moz-none; diff --git a/webroot/rsrc/css/core/remarkup.css b/webroot/rsrc/css/core/remarkup.css index 055b7e37ea..34602363d3 100644 --- a/webroot/rsrc/css/core/remarkup.css +++ b/webroot/rsrc/css/core/remarkup.css @@ -10,6 +10,21 @@ margin: 0 0 12px; } +.PhabricatorMonospaced, +.phabricator-remarkup .remarkup-code-block .remarkup-code { + font: 10px "Menlo", "Consolas", "Monaco", monospace; +} + +.platform-windows .PhabricatorMonospaced, +.platform-windows .phabricator-remarkup .remarkup-code-block .remarkup-code { + font: 11px "Menlo", "Consolas", "Monaco", monospace; +} + +.phabricator-remarkup .remarkup-code-block { + margin: 12px 0; + white-space: pre; +} + .phabricator-remarkup .remarkup-code-header { padding: 4px 1px; font-size: 13px; diff --git a/webroot/rsrc/css/phui/phui-fontkit.css b/webroot/rsrc/css/phui/phui-fontkit.css index 792776f63b..cb55492754 100644 --- a/webroot/rsrc/css/phui/phui-fontkit.css +++ b/webroot/rsrc/css/phui/phui-fontkit.css @@ -17,6 +17,21 @@ line-height: 18px; } +.PhabricatorMonospaced .phui-document-view .phui-font-source-sans, +.phui-document-view .phui-font-source-sans .phabricator-remarkup + .remarkup-code-block .remarkup-code { + font-size: 11px; + line-height: 1.3em; +} + +.platform-windows .PhabricatorMonospaced .phui-document-view + .phui-font-source-sans, +.platform-windows .phui-document-view .phui-font-source-sans + .phabricator-remarkup .remarkup-code-block .remarkup-code { + font-size: 12px; + line-height: 1.3em; +} + .phui-font-source-sans .phabricator-remarkup h2.remarkup-header { padding: 8px 24px 8px 0; border-bottom: 1px solid {$thinblueborder};