Yes. I am quite familiar with those terms. In order to use extends, one first needs a method. I don’t have a method yet from the LR
I might have found out the algorithm. Yes it is an algorithm because if you put things in the wrong then other things don’t work.
I also haven’t tested this. I also have another question at the end.
From BitmapForCaching
but there is no code separate from the shown method.
I am including this to let the reader know I have read the LR and there is no algorithm.
From
or 51496-temporarily-installed-fonts-don-t-work-in-xojo-s-gdi-text-rende
[quote=417287:@Carlo Rubini]In a canvas I put the following code, but no text is shown.
Replacing self.BitmapForCaching with new Picture too shows no text, but the app does not crash.
Dim p As Picture = self.BitmapForCaching(g.Width, g.Height)
g.drawpicture p,0,0
p.Graphics.TextSize = 18
p.Graphics.TextFont = mFont//a temporally installed font
p.Graphics.ForeColor = &c000000
p.Graphics.bold = true
p.Graphics.DrawString “???” + EndOfLine + “???” + EndOfLine + “???”,0,0[/quote]
As I’ve already explained Self isn’t applicable.
Using the above code
Dim p As Picture = tCont.
doesn’t quite work because BitmapForCaching cannot follow it.
It has to be TrueWindow.BitmapForCaching
This is my previous basic code.
My Method Name with Parameters SetFontSize (tCont As TextArea)
Dim eHeight As Integer = tCont.Height
Dim eWidth As Integer = tCont.Width
dim picText2 as new Picture(eHeight, eWidth, 32)
dim fSize, vL, vR, mvL, mvR As Integer //The fontsize that is larger than SizeOfFontMin
//vL and vR are identifying areas in SelText. mvL and mvR are for identifying for Mid removal
//vL is start StyledText, vR is end of StyledText
dim g As Graphics = picText2.Graphics
fSize = SizeOfFontMax//defined elsewhere
g.TextFont = DispFont//defined elsewhere
g.TextSize = fSize
vR = g.StringHeight(stkOfStrgs(0), eWidth)
While vR > eHeight And fSize > SizeOfFontMin // Sets the area for ALL text size so everything will fit in the TextArea provided it is larger SizeOfFontMin
fSize = fSize -1
g.TextSize = fSize
vR = g.StringHeight(stkOfStrgs(0), eWidth-15)
If fSize = SizeOfFontMin Then Exit While
Wend
tCont.TextSize = fSize
Return
When I posted my first part here I knew that if I put this in first other things wouldn’t work.
Var myW As TrueWindow = tCont.TrueWindow.BitmapForCaching( eWidth, eHeight )
I also knew if I defined Picture above this, then nothing apparently with BitmapForCaching works.
The code the analyzer likes is replacing my picture definition with
Var picText2 as Picture = tCont.TrueWindow.BitmapForCaching( eWidth, eHeight )//32 is Depth or bits
Unfortunately, depth is missing from the pitcure definition and if I just put a comma and 32 it doesn’t like it.
Var picText2 as Picture = tCont.TrueWindow.BitmapForCaching( eWidth, eHeight ) , 32
BTW Picture has no mention of BitmapForCaching
So my question is now how do I get a constructor for Picture with BitmapForCaching and depth.