<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        
                                        
                                            
                                        
                                        
                                        Hi Subbu.<div><br></div><div>> <span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">I saw direct ivar access instead of the fontsToUse </span><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">from other places also.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Looks fine. The few ivar reads have ifNil-checks. ivar write is only in #initialize* and #set* methods. Calling #font will never return "nil". So "self font textStyle" is fine.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">> </span><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">How about this patch?</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Ah, well. You are right. The internals of StringMorph can deal with both font and emphasis being nil. </span><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">The goal would be to reduce the number of #ifNil checks. If somebody would send #setFont:emphasis: with nil and nil -- which would not be okay because (1) #set* is rather internal initialization code and (2) one of both should be non-nil -- everything would work. However, if somebody would send #font:emphasis: with nil and nil, then the error message is awkward.</span></div><div><br></div><div>You assertion looks good. I will add comments, too.</div><div><br></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Best,</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Marcel</span></div><div class="mb_sig"></div>
                                        
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 25.05.2020 10:18:40 schrieb K K Subbu <kksubbu.ml@gmail.com>:</p><div style="font-family:Arial,Helvetica,sans-serif">On 25/05/20 12:49 pm, Marcel Taeumel wrote:
<br>> Well, either aFont or emphasisCode can be nil. Not both. ;-) If I recall 
<br>> correctly, that's the existing usage I found when refactoring 
<br>> StringMorph last year in summer. It would be strange to support both 
<br>> arguments to be nil.
<br>
<br>StringMorph>>initializeFromText uses 'self font textStyle' without 
<br>checking for nil. I saw direct ivar access instead of the fontsToUse 
<br>from other places also.
<br>
<br>How about this patch?
<br>
<br>self assert: (aFont notNil | emphasis notNil).
<br>font := aFont.
<br>emphasis := emphasisCode ifNil: [0].
<br>
<br>Regards .. Subbu
<br></div></blockquote></div>