CSharpShellApp icon indicating copy to clipboard operation
CSharpShellApp copied to clipboard

Fontsize

Open Aksword opened this issue 3 years ago • 6 comments

Hello, the System.drawing is available on the app, but when I want to call the Font function and change the font and its size, I get an error message. Does someone have a clue about how to change the font size ? Thanks !

Aksword avatar Nov 03 '22 17:11 Aksword

i think its TextSize if im not wrong

jgranserver avatar Nov 04 '22 03:11 jgranserver

I searched and text-size is for CSS, all I found for C# is the Font class (which doesn't work), and the Labell. , which is only available in the Windows.Forms library.

Aksword avatar Nov 04 '22 11:11 Aksword

Font size? Are we talking about the console? And what error message? PlatformNotImplementedException? System.Drawing.Common is what is in the app, just data structures. Android doesn't have the features Windows does in System.Drawing. I'll add a FontSize property to the app's Console class.

radimitrov avatar Nov 06 '22 15:11 radimitrov

To change the font size, all I found on the net was to create a new Font. So I wrote : Font test = New Font("Arial", 24); And I got : System.PlatformNotSupportedException: Operation is not supported on this platform. at System.Drawing.Font..ctor (System.String familyName, System.Single emSize) [0x00006] in :0 at (wrapper remoting-invoke-with-check) System.Drawing.Font..ctor(string,single) at Emojisgame.Program.Main () [0x00000] in :0 at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&) at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <02432465956f42cebcacad2804482ab1>:0 Maybe you know another way to do that, and thanks for your next adding !

Aksword avatar Nov 06 '22 21:11 Aksword

Yes, pretty much what I expected. Not implemented for Android. Probably only the basics are. Additionally, it seems Microsoft are removing that package entirely for non-Windows platforms. https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only

radimitrov avatar Nov 07 '22 11:11 radimitrov

If we're talking about platform specific equavelents then a Font is a Typeface in Android. And the Android.Graphics namespace contans stuff like Bitmap and Canvas. These are all in Mono.Android.dll

radimitrov avatar Nov 07 '22 11:11 radimitrov