alexmullins / freetype-go Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/freetype-go
License: Other
Automatically exported from code.google.com/p/freetype-go
License: Other
When stroking polyline with a path, lines are not joined very well
(see the Attached screenshot, line width is 20)
I think this is a bug.
below you can see a short extract of the code(gc mean graphic context) that
stroke a rectangle
func (gc *GC) StrokeRect(line [4]float) {
gc.path.Start(toPoint(line[0], line[1]))
gc.path.Add1(toPoint(line[2], line[1]))
gc.path.Add1(toPoint(line[2], line[3]))
gc.path.Add1(toPoint(line[0], line[3]))
gc.path.Add1(toPoint(line[0], line[1]))
raster.Stroke(gc.rasterizer, gc.path, raster.Fix32(gc.lineWidth*256), nil, nil)
b := gc.image.Bounds()
mask := image.NewAlpha(b.Dx(), b.Dy())
painter := raster.NewAlphaOverPainter(mask)
gc.rasterizer.Rasterize(painter)
strokeColor := image.NewColorImage(gc.strokeColor)
draw.DrawMask(gc.image, gc.image.Bounds(), strokeColor, image.ZP, mask, image.ZP, draw.Over)
gc.rasterizer.Clear()
gc.path.Clear()
}
func toPoint(x, y float) raster.Point {
return raster.Point{raster.Fix32(int(x * 256)), raster.Fix32(int(y * 256))}
}
Original issue reported on code.google.com by [email protected]
on 14 Nov 2010 at 8:36
Attachments:
It seems that the truetype package cannot load the OpenSans font.
The font is compatible with other TTF viewers/editors.. so I wonder why I
receive this error (from freetype.ParseFont() function):
freetype: invalid TrueType format: bad kern table length
Download font at www.opensans.com, I used the OpenSans-Regular.ttf font, but it
seems all the OpenSans fonts do not parse properly.
Best regards,
Stephen
Original issue reported on code.google.com by [email protected]
on 26 May 2013 at 4:47
When p.X is less than zero, the position of first letter of s is incorrect!
Original issue reported on code.google.com by [email protected]
on 30 Nov 2013 at 7:47
Attachments:
These are needed to figure out line height and the height for the background of
highlighted text. Font.Bounds().YMin and YMax don't work; they are too large.
Instead we need ascent and descent from the hhea table.
Original issue reported on code.google.com by [email protected]
on 16 Feb 2015 at 8:13
I would like to be able to get at the font name(s) stored in the truetype in
the font file.
Original issue reported on code.google.com by [email protected]
on 29 May 2014 at 12:39
the line 1346 - 1347 looks weird
1346 n := f26dot6(h.stack[top])
This may be pedantic, but "n" in this case is a counter used for the loop at
line 1350: "for ; n > 0; n--"
It is in no way a 26.6 fixed point value so why cast it to f26dot6 ?
------
line 1347 if top < 2*int(h.gs.loop) {
This may be a copy/paste error, I don't see how the gs.loop value has anything
to do with deltaP or deltaC.
I'm assuming you want:
line 1347 if top < 2*n {
Original issue reported on code.google.com by [email protected]
on 5 Nov 2014 at 8:45
cm@ubuntu:~/go/src/pkg/github.com/chsc/gogl$ sudo /home/cm/go/bin/go get
code.google.com/p/freetype-go/freetype
package code.google.com/p/freetype-go/freetype
imports fmt: unrecognized import path "fmt"
package code.google.com/p/freetype-go/freetype
imports image: unrecognized import path "image"
package code.google.com/p/freetype-go/freetype
imports image/color: unrecognized import path "image/color"
package code.google.com/p/freetype-go/freetype
imports image/draw: unrecognized import path "image/draw"
package code.google.com/p/freetype-go/freetype
imports math: unrecognized import path "math"
package code.google.com/p/freetype-go/freetype
imports runtime: unrecognized import path "runtime"
package code.google.com/p/freetype-go/freetype
imports strconv: unrecognized import path "strconv"
package code.google.com/p/freetype-go/freetype
imports errors: unrecognized import path "errors"
Original issue reported on code.google.com by [email protected]
on 14 Oct 2012 at 10:34
Hi, I'm currently packaging Go and several modules including this one. Is there
any reason to have that much AUTHORS / LICENSE / README files? I'd prefer to
have only those on the top-level.
Furthermore, the aes and twofish subdirs dont' have working Makefiles, so
they're currently ignore for package builds. Plans to fix?
Original issue reported on code.google.com by [email protected]
on 9 Nov 2010 at 8:40
From a Go synced/built from "release" branch:
$ goinstall freetype-go.googlecode.com/hg/freetype
/bin/bash: === cd
/home/shutej/go/src/pkg/freetype-go.googlecode.com/hg/freetype/raster; bash
gomake -f- install
6g -o _go_.6 geom.go paint.go raster.go stroke.go
paint.go:65: cannot convert c (type image.AlphaColor) to type int
paint.go:66: cannot use uint8((v * 255 + (255 - v) * a) / 255) (type uint8) as
type image.AlphaColor in assignment
paint.go:105: cannot use color (type uint8) as type image.AlphaColor in
assignment
paint.go:150: cannot convert r.Image.Pix[i + 0] (type image.RGBAColor) to type
uint32
paint.go:151: cannot convert r.Image.Pix[i + 1] (type image.RGBAColor) to type
uint32
paint.go:152: cannot convert r.Image.Pix[i + 2] (type image.RGBAColor) to type
uint32
paint.go:153: cannot convert r.Image.Pix[i + 3] (type image.RGBAColor) to type
uint32
paint.go:155: cannot use uint8((dr * a + r.cr * ma) / m >> 8) (type uint8) as
type image.RGBAColor in assignment
paint.go:156: cannot use uint8((dg * a + r.cg * ma) / m >> 8) (type uint8) as
type image.RGBAColor in assignment
paint.go:157: cannot use uint8((db * a + r.cb * ma) / m >> 8) (type uint8) as
type image.RGBAColor in assignment
paint.go:157: too many errors
make: *** [_go_.6] Error 1
--- exit status 2
goinstall: installing: running bash: exit status 2
Original issue reported on code.google.com by [email protected]
on 14 Jul 2011 at 3:44
goinstall cannot find the image/draw package with the latest release of Go. It
appears the package is actually @ /go/src/pkg/exp/draw
Original issue reported on code.google.com by [email protected]
on 10 Jun 2011 at 11:08
Freetype-go generates artifacts close to start and end path points,
output differs from Freetype-C.
Font is automatically converted from C to Q by FontForge, no problems detected.
Rearanged canonical start point to leftmost on the contour produces expected
output.
Original issue reported on code.google.com by [email protected]
on 20 Feb 2015 at 9:48
Attachments:
It is currently not possible to get the bounding box of a specific glyph, and
thus one can't figure out all the metrics one might need. Please add something
like func (f *Font) Bounds(scale int32, i Index) Bounds.
Original issue reported on code.google.com by [email protected]
on 7 Feb 2015 at 1:38
With freetype-go, is there a way to compute the text extents (width and height)
of a string given a particular font and size *before* rendering the text?
I've looked around in the source code, and it *appears* that the right
information is there, but I can't quite seem to figure out how to do it.
As of right now, if I want an image that "snugly" fits some string, I do the
following:
Over estimate the extents by multiplying the pixel size of one em unit by the
length of the string. I get the width/height this way (assuming one line of
text).
I allocate an image with a rectangle of two points: (0, 0) and (width, height).
After rendering the text to the image using DrawText, I use the point returned
from DrawText to take a sub-image of the initial image. (I convert this point
to a (x, y) position by simply dividing the X and Y of the point by 256. It
seems to work OK, but I have no idea if this is correct.)
--------------
And one last question: would the extents include the entire bounding box of the
string? The (x,y) position returned by DrawText doesn't seem to cover the parts
of the text the dip below the text's base line. Like the tail in the 'y'. My
solution has just been to pad the 'y' with a few pixels, but I know this is not
optimal since it will break if the font size changes too much.
(My apologies if my terminology is off. I don't have much experience in font
rendering.)
I would happily submit a patch if I was nudged in the right direction :-)
Thanks!
Original issue reported on code.google.com by [email protected]
on 2 Jun 2012 at 10:44
in hint.go line 671:
curDist := dotProduct(f26dot6(p.X-ref.X), f26dot6(p.Y-ref.Y), h.gs.dv)
as per the specifications:
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM05/Chap5.html#IP
I think the distance should be computed using the projection vector and not the
dual vector. (h.gs.pv instead of h.gs.dv)
correct line:
curDist := dotProduct(f26dot6(p.X-ref.X), f26dot6(p.Y-ref.Y), h.gs.pv)
The equivalent code in Freetype is:
distance = CUR_Func_project( CUR.zp1.cur + point,
CUR.zp0.cur + CUR.GS.rp0 );
Where CUR_Func_project use the projection vector:
return TT_DotFix14( (FT_UInt32)dx, (FT_UInt32)dy,
CUR.GS.projVector.x,
CUR.GS.projVector.y );
Original issue reported on code.google.com by [email protected]
on 4 Nov 2014 at 1:38
I have no idea how to submit patches, so forgive me if this is an inappropriate
venue.
Attached is a patch fixing TTC parsing.
The constant 12 was hardcoded instead of using `offset`.
Tested on a TTC v2.0 file, I don't have a v1.0 file to test on but based on
what I understand of the file format I don't think there should be any issues
with that.
Original issue reported on code.google.com by [email protected]
on 10 Sep 2014 at 4:30
Attachments:
What steps will reproduce the problem?
1. Use a non-image.Uniform image in SetSrc.
2. Call freetype.DrawString
What is the expected output? What do you see instead?
I'd expect that the src passed to c.SetSrc gets composited with the destination
with the two images aligned.
Instead, for each glyph, a region (0, 0) to (w, h) gets used from src, where w,
h are the dimensions of the glyph, with the result that the actual colors taken
from src depending on the height of the rendered glyph and adjacent glyphs are
inconsistently colored.
What version of the product are you using? On what operating system?
Lion on mac, but I'm sure that's irrelevant.
Please provide any additional information below.
In: http://code.google.com/p/freetype-go/source/browse/freetype/freetype.go#212
I think image.ZP should be dr.Min, or possibly adjusted to align src.Min and
dst.Min.
The comment would need fixing too to specify the meaning of the SetSrc value.
Attached is a variant of one of the example files that exhibits the problem.
I've tried to make the colors as nasty as possible to make the problem visible.
I've also attached a png with the output.
Original issue reported on code.google.com by [email protected]
on 1 Aug 2012 at 7:56
Attachments:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.