I want to create a simple ttf font within an iphone/ipad app. The concept is that the user will draw each letter and I will create a collection to build the ttf file.
Initially, I thought I would have to export the images from the app to a font editor such as fontforge on a server, but I am now convinced that it is possible to generate a ttf file on the device.
Here is what I think needs to happen:
1) Enable the drawing using OpenGL
2) Save the images. Is this in a vector format or as bitmap?
3) Organize the collection as a ttf file
Can someone point me in a successful direction?
1) Enable the drawing using OpenGL
And herein lies your first misconception. OpenGL is best thought as a one way device. You put drawing commands into it, and it produces a nice picture on the screen. But OpenGL is neither a geometry nor a math library.
2) Save the images
For the creation of a TTF the raw data you send to OpenGL is much more useful, than anything you could read back from OpenGL.
In particular you'll have a list of strokes, which you could convert into an outline, that then can be converted into a glyph.
Related
So I have created some fancy graphics with Adobe Animate (HTML CANVAS)and added some animation as well. Is there a way to manipulate (or simply get) the Javascript code that generated these graphics? Say I want to use these same graphics in another project. How to extract that code? The generated code is not just simple CreateJS code. It is very tight to the Animate framework.
The code is in fact just plain CreateJS (EaselJS) code. In your generated lib file, you can see all the Graphic instructions for each Shape. For Animate, it uses a "compressed" format by default (which you can actually see in the docs). Since 95% of developers don't care what the exported graphics look like, so it uses a custom compression format to reduce the amount of code that is generated, which results in a much smaller filesize.
You can easily pop into the publish settings, and under "Advanced" turn off the "Compact Shapes" option, which will give you typical lineTo().moveTo().drawRect() commands again.
Hope that helps!
Example of tileset:
http://www.rpg-studio.org/wiki/images/9/92/Tileset.png
How to import these images into this grid in Xcode?
https://koenig-media.raywenderlich.com/uploads/2016/06/AdjacencyTileGrid.png
The problem is Xcode doesn't understand that there is a lot of subimages inside parent image.
I've already saw a lot of examples which use tiled map editor but it has its own format and you can't design such levels in Xcode's visual editor. So they are not appropriate for me.
I also saw that people always avoid to use tilesets - they somewhere get a lot of separate images instead and doesn't describe what to do with a single big tileset.
The simplest solution might be to just start with individual images that can feed into Xcode’s image handling pipeline.
My understanding of the Tilesets you’ve described is they are produced from individual images with a tool like TexturePacker which is then consumed by the Tiled Map Editor. The tmx maps produced by the Tiled Map Editor are consumed in Xcode using SKTiled for Swift or JSTileMap for Objective-C.
I want to mask a UIView with a Core Graphics path. I’ve created this path in the Grapher tool on OS X and saved it as a vector file (specifically EPS file) hoping to load it in to iOS and mask the UIView. This way I don’t have to use a bitmap image.
I can’t seem to find a way to turn a vector image in to a Core Graphics path though, if anyone has any idea I’d love to know.
Thanks
UPDATE: Since XCode6 it is possible to add Vector images, skipping the part of preparing 1,2,3x versions. Saves time and looks perfect. The format is PDF, which you may export in correct size from apps like Sketch or Graphic (formerly iDraw) and others.
Full tutorial featured here: http://www.appcoda.com/xcode6-tips-tricks/
Scroll way down for Vector tutorial almost to end of an article.
I haven't found a way to use EPS for vector graphics in iOs and honestly there's a better way to do this, as there are apps for that. The process is much more similar to SVG not EPS images. What you need is an app, that can export Core Graphics code.
I am using iDraw, that can both export graphics as CSS code for web site design and Core Graphics code for iOs app design. Sketch app for Mac does this as well. Both of these are cheap compared to Big Name vector graphics software.
So here is a workflow. You import EPS or draw a custom illustration, group shapes, right click on it and copy as a core graphics code. Then paste it in let's say a Cocoa Touch class Swift file, draw it (get the Graphics Context -> draw shapes at coordinates -> add subview to view).
// get the graphics context
var context = UIGraphicsCurrentContext()
// draw shapes here or paste core graphics code
// don't forget about coordinates (theyr'e not the same as pasted from graphics software)
// Add to view
var yourView = ShapeViewName(frame: CGRectMake ( .... ))
view.addSubView(yourView)
Hope this helps.
It there a way to draw a complex shape with an application like CorelDraw or Adobe Flash, etc, save it or export it as a PDF and then open it with Core Graphics in iOS.
The idea is, to draw a shape, a vector, with CorelDraw - for example, and it is just the path. No color or fill. And then be able to open it directly by Core Graphics, add it as a CGPath to the context, and then be able to manipulate it, like fill it with solid color or gradient, or patterns.
The bottom line is, I am looking for a way to draw a complex shape in a user-friendly environment, like Corel or Flash, and export it, as a vactor, which can be manipulated in Core Graphics. And suggestions or help is really appreicated.
Thanks.
SVGKit doesn't work the exact same as I need either. Although I should say it is nicely done. There are also other resources, that I found and I'll leave them here for future references, if anyone stops by this post and is looking for a solution.
Converting SVG Paths to Objective-C Paths Good for simple paths; strokes and fills can be manipulated later by using protocols. Complex paths get mixed up.
SVGKit Good for creating images and animate them later through the course of the program. However, strokes, fills, paths can not be manipulated.
Opacity You can export as source code, hence you have more control over strokes, paths, and fills. As the path gets more complex, it is harder to manage the code manually. The other problem is by the time of export, the program adds resolution-dependent codes. It can be a pain to go through about 300+ lines of code to fix it so that it is not resolution dependent. By the final product wouldn't be mixed up, and can be manipulated by protocols. Layers are CGLayers, not CALayers.
If, as you say, you've got PDF files (from Corel, or another app), you can display them using CoreGraphics.
Take a look at the:
CGPDFDocument class
CGPDFPage class
Then, there is a CGContextDrawPDFPage function, that you can use to draw a PDF pages in a given graphic context, typically in the drawLayer: inContext: method of a UIView subclass.
There isn't really a built-in way to load CGPaths from files but you might want to take a look at SVGKit. Pretty much every modern vector drawing app can produce SVG files.
I am looking for a more convenient way of drawing a path than by drawing it programmatically. Is there any way of drawing a path in Photoshop (or Illustrator) and getting that path to the iPhone to use in a CAKeyframeAnimation? e.g. by exporting the point data, or by importing the .ai file?
There's a GitHub project called "PocketSVG" that can create UIBezier objects from SVG files. It works perfectly with shapes created in Adobe Illustrator and exported to SVG Tiny 1.2.
I ended up using Opacity. Opacity is a nifty little program that will allow you to draw paths (or import images) and export source code for iOS (e.g. Quartz).