Can iOS class library have a font resource? - xamarin.ios

I have an iOS class library myClassLibrary added as a reference to my iOS app myiOSApp:
MyiOSApp.sln
myiOSApp.csproj
References
myClassLibrary
myClassLibrary.csproj
I want to add a font file to the myClassLibrary:
myClassLibrary.csproj
Resources
MyFont.ttf (BundleResource)
In the myiOSApp, I have in my Info.plist the following:
<key>UIAppFonts</key>
<array>
<string>MyFont.ttf</string>
</array>
But trying to load the font doesn't work:
var font = UIFont.FromName(fontName, size);
If I include the font file directly in the iOS App then the font loads correctly so I know I have the name correct.

I did the same thing as you and it works on my side.
I uploaded my sample here: custom-font-xamarin.iOS so that you can refer.
Refer: using-custom-fonts-with-xamarin-ios

Related

How to convert SVG format to DWG format in .net Core

I am using .NET Core Application and My requirement is to convert DWG to SVG and SVG to DWG formats.
I have converted DWG format to SVG format using Aspose.CAD library successfully as below.
// Load the input DWG file
Image image = Image.Load("sample.dwg");
// Initialize SvgOptions class object
Aspose.CAD.ImageOptions.SvgOptions options = new Aspose.CAD.ImageOptions.SvgOptions();
// Set SVG color mode
options.ColorType = SvgColorMode.Grayscale;
options.TextAsShapes = true;
// Save output SVG file
image.Save("sample.svg", options);
But I am not getting how to convert back SVG to DWG.
It would be really helpful to me if someone suggests me other alternatives for Aspose.CAD library which can achieve DWG to SVG and SVG to DWG. I am OK even if its a Licensed Version.

Can I import svg into Gideros?

Ok I will admit to being a noob with Gideros. I am trying to import an svg file. I followed the same procedure as you would do for a png file, that is create a texture using:
myTexture = Texture.new("orangeSquare.svg")
orangeSquare = Bitmap.new(myTexture)
stage:addChild(orangeSquare)
Unsurprisingly it doesn't work (output gives orangeSquare.svg: Error while reading image file. and program does not run) as it is not a bitmap file. Is there an alternative to import svg files? It is probably a very simple solution but I have been searching for some time without an answer. I am considering giving up on Gideros if I don't find an answer to what should be a simple problem.
You can not import the svg directly, you need to pass the svg data:
--Banana shape, SVG path format
local banana = "M8.64,223.948c0,0,143.468,3.431,185.777-181.808c2.673-11.702-1.23-20.154,1.316-33.146h16.287c0,0-3.14,17.248,1.095,30.848c21.392,68.692-4.179,242.343-204.227,196.59L8.64,223.948z"
p=Path2D.new()
p:setSvgPath(banana) --Set the path from a SVG path description
p:setLineThickness(5) -- Outline width
p:setFillColor(0xFFFF80,0.7) --Fill color
p:setLineColor(0x404000) --Line color
p:setAnchorPosition(100,100)
stage:addChild(p)
You can find more info on their wiki: https://wiki.giderosmobile.com/index.php?search=svg&title=Special%3ASearch&go=Go&fulltext=1
They also have it as a sample project when you open gideros studio.

How to create folder in my android file manager via kivy android application

I'm trying to develop android application by using kivy. For testing I need to select an image from my internal storage, convert it into gray scale image and it needs to be stored in a particular folder.
I was wondering how to achieve this, every option is welcome.
Thanks in advance
If I understand correctly you are trying to show an image from a particular folder. You can achieve this by adding a image to your .kv file:
Image:
source: '/myfolder/mylogo.png'
Or if you are getting the path from you python file. You can use get the path by calling the function in your kv file which you can use this:
<MyScreen>:
on_pre_enter: get_image()
image:
size: self.width self.height

Python3, Gtk3, Glade, set label color from code

I have a Glade file with a label with a gray default color,
which I want to override with green from code.
Therefore I added a style class in Glade:
and added this to my Python script:
However, the color remains gray.
What did I do wrong?
I made it a bit differently.
in a fileforcolors.css
I included
#resetstddata_button {
background: #00BFFF;
}
where the "resetstddata_button" is the name of the widget in the glade file (open the glade editor, click on the GtkButton you want to change the color, page "common", you see the parameter entry "Widget name", put the "resetstddata_button" in it ).
The python3 code extract for this button color change is:
style_provider = gtk.CssProvider()
css = open('/home/fileforcolors.css',
'rb') # rb needed for python 3 support
css_data = css.read()
css.close()
style_provider.load_from_data(css_data)
gtk.StyleContext.add_provider_for_screen(gdk.Screen.get_default(), style_provider,
gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
Hopefully it helps.
The problem was, that Glade initially preceded the style class name with a dot in its generated XML file (see screenshot in the OP).
You need to edit the Glade XML file and remove it:
After that, you can repeatedly change the style class name in the Glade GUI, it does not get a dot again.

Why is bodymovin exporting PNG's and not SVG's?

I'm trying to use lottie to animate an SVG animation created in After Effects. I use the bodymovin extension to export the JSON data file. But, I also noticed the export includes some PNG images. I'm also getting console errors that said PNG's can not be found.
Why is it exporting PNGs as I'm using SVG (an AI file) in AE. Below is my code, and the error.
index.ts
import * as lottie from 'lottie-web';
import * as header from './assets/header.json';
import './css/base.sss';
var animation = lottie.loadAnimation({
container: document.getElementById('header'),
animationData: header,
renderer: 'svg/canvas/html',
autoplay: true
});
But I'm getting the following errors that the images can't be found. Why is bodymovin exporting/looking for pngs? I require SVG's.
Chrome console errors (sorry can't embed until 10 rep)
I found the problem. I have to convert paths to shapes in AI as noted here.
In Adobe After effect, you can use Create Shapes from vector layer
Another way I found was to search the exported .json file for the .png extension and replace the found extensions with .svg. Making sure to add the .svg files to the same directory.
I used this bodymovin render option:
I did my search in the .json file in Dreamweaver like so:
I hope this helps someone!!!

Resources