<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Ah, finally! :D I think that Kent Beck at some point recommended not to define too many conversion messages, especially for very short and potentially misunderstandable selectors like these, but on the other hand, I am just happy about the improved convenience.</p>
<p><br>
</p>
<p>Note that once we use this protocol consistently, the dependency browser and the dependency tests will no longer inform us about all dependencies to the Graphics package. Or am I wrong?</p>
<p><br>
</p>
<p>Best,</p>
<p>Christoph</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von commits@source.squeak.org <commits@source.squeak.org><br>
<b>Gesendet:</b> Mittwoch, 22. Juni 2022 11:47:43<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org; packages@lists.squeakfoundation.org<br>
<b>Betreff:</b> [squeak-dev] The Trunk: Graphics-mt.524.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Marcel Taeumel uploaded a new version of Graphics to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Graphics-mt.524.mcz">http://source.squeak.org/trunk/Graphics-mt.524.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Graphics-mt.524<br>
Author: mt<br>
Time: 22 June 2022, 11:47:35.985723 am<br>
UUID: fc41bc62-0b72-a14f-999b-12d64a0a0cff<br>
Ancestors: Graphics-mt.523<br>
<br>
Document programming model for scale-factor-aware applications.<br>
<br>
Note that this is not yet used throughout the system. However, applications written for Squeak 6.0 should be able to look as elegant as possible.<br>
<br>
=============== Diff against Graphics-mt.523 ===============<br>
<br>
Item was added:<br>
+ ----- Method: Number>>em (in category '*Graphics-scale factor') -----<br>
+ em<br>
+        "Convert the receiver from multiples of width-of-capital-letter-M to pixels using the system's default font. Works also with pre-rendered fonts."<br>
+        <br>
+        ^ (self * (TextStyle defaultFont widthOf: $M)) rounded!<br>
<br>
Item was added:<br>
+ ----- Method: Number>>ex (in category '*Graphics-scale factor') -----<br>
+ ex<br>
+        "Convert the receiver from multiples of x-height-of-font to pixels using the system's default TrueType font."<br>
+ <br>
+        | tt |<br>
+        tt := TextStyle defaultTTFont ttcDescription.<br>
+        ^ (self asFloat<br>
+                * (tt xHeight asFloat / tt unitsPerEm)<br>
+                * (TextStyle defaultFont widthOf: $M)) rounded!<br>
<br>
Item was added:<br>
+ ----- Method: Number>>pt (in category '*Graphics-scale factor') -----<br>
+ pt<br>
+        "Convert the receiver from points to pixels. Note that this will not work correctly for 'faked' scale factors where larger (pre-rendered) fonts are used instead of adjusting the system's current ppi value."<br>
+ <br>
+        ^ (TextStyle pointsToPixels: self) rounded<br>
+ <br>
+ "<br>
+ (TextStyle pixelsPerInch = 96.0 ifTrue: [<br>
+        | extra |<br>
+        extra := TextStyle defaultFont pointSize / TTCFont referencePointSize.<br>
+        ^ (TextStyle pointsToPixels: self * extra) rounded]<br>
+ "!<br>
<br>
Item was added:<br>
+ ----- Method: Number>>px (in category '*Graphics-scale factor') -----<br>
+ px<br>
+        "Convert the receiver representing raw pixels at 100% (96ppi) to the current scale factor. Note that you currently have to do this manually for all graphics-related properties and layout-specific measures such as #borderWidth: and #layoutInset:. Only
 for model windows (see #initialExtent) that are no dialogs, that scaling will happen automatically in ToolBuilder."<br>
+ <br>
+        self flag: #discuss. "mt: For self > 4, I would recommend #rounded instead of #truncated. For smaller values, however, rounding makes no sense because we have no sub-pixel access and things would look too big too soon."<br>
+        ^ (self * RealEstateAgent scaleFactor) truncated!<br>
<br>
<br>
</div>
</span></font>
</body>
</html>