IDEA-243003 Ability to disable font fractional metrics on macOS is missing

GitOrigin-RevId: 970d64408f34b5ce386b823e4e1cff7454308a55
This commit is contained in:
Vassiliy.Kudryashov
2020-06-11 23:29:20 +03:00
committed by intellij-monorepo-bot
parent 1965c07a7e
commit 0fc97b0a38
4 changed files with 16 additions and 11 deletions
@@ -475,14 +475,19 @@ class UISettings @NonInjectable constructor(private val notRoamableOptions: NotR
val shadowInstance: UISettings
get() = instanceOrNull ?: UISettings(NotRoamableUiSettings())
@JvmField
val FORCE_USE_FRACTIONAL_METRICS = SystemProperties.getBooleanProperty("idea.force.use.fractional.metrics", SystemInfo.isMacOSCatalina)
@JvmStatic
val PREFERRED_FRACTIONAL_METRICS_VALUE: Any
get() {
return if (!Registry.`is`("ide.disable.fractionalMetrics", false)
&& SystemProperties.getBooleanProperty("idea.force.use.fractional.metrics", SystemInfo.isMacOSCatalina))
RenderingHints.VALUE_FRACTIONALMETRICS_ON
else
RenderingHints.VALUE_FRACTIONALMETRICS_OFF
}
@JvmStatic
fun setupFractionalMetrics(g2d: Graphics2D) {
if (FORCE_USE_FRACTIONAL_METRICS) {
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON)
}
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, PREFERRED_FRACTIONAL_METRICS_VALUE)
}
/**
@@ -33,7 +33,7 @@ class SignatureChangePresentation(
private val dummyFontRenderContext = FontRenderContext(
AffineTransform(),
AntialiasingType.getKeyForCurrentScope(false),
if (UISettings.FORCE_USE_FRACTIONAL_METRICS) RenderingHints.VALUE_FRACTIONALMETRICS_ON else RenderingHints.VALUE_FRACTIONALMETRICS_OFF
UISettings.PREFERRED_FRACTIONAL_METRICS_VALUE
)
val requiredSize by lazy {
@@ -600,10 +600,7 @@ public final class LafManagerImpl extends LafManager implements PersistentStateC
uiDefaults.put(RenderingHints.KEY_TEXT_ANTIALIASING, AntialiasingType.getKeyForCurrentScope(false));
uiDefaults.put(RenderingHints.KEY_TEXT_LCD_CONTRAST, UIUtil.getLcdContrastValue());
uiDefaults.put(RenderingHints.KEY_FRACTIONALMETRICS,
UISettings.FORCE_USE_FRACTIONAL_METRICS
? RenderingHints.VALUE_FRACTIONALMETRICS_ON
: RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
uiDefaults.put(RenderingHints.KEY_FRACTIONALMETRICS, UISettings.getPREFERRED_FRACTIONAL_METRICS_VALUE());
for (Frame frame : Frame.getFrames()) {
updateUI(frame);
@@ -1350,7 +1350,10 @@ ide.text.effect.new.scale=true
ide.text.effect.new.scale.description=Enables scalable effect painter for text
ide.text.effect.new.metrics=true
ide.text.effect.new.metrics.description=Use line metrics to calculate text offset in the effect painter
ide.disable.fractionalMetrics=false
ide.disable.fractionalMetrics.restartRequired=true
ide.disable.fractionalMetrics.description=Fractional metrics are used by default in macOS Catalina to improve font rendering. \
In some cases it may cause slowdown and the key allows switch them off
ide.intellij.laf.enable.animation=false
ide.intellij.laf.enable.animation.description=Provides visually smooth switching between LAFs