Git Product home page Git Product logo

gltext's Introduction

gltext

Note: This package is experimental and subject to change. Use at your own discretion.

The gltext package offers a simple set of text rendering utilities for OpenGL programs. It deals with TrueType and Bitmap (raster) fonts. Text can be rendered in various directions (Left-to-right, right-to-left and top-to-bottom). This allows for correct display of text for various languages.

The package supports the full set of unicode characters, provided the loaded font does as well.

TODO

Known bugs

  • Determining the height of truetype glyphs is not entirely accurate. It is unclear at this point how to get to this information reliably. Specifically the parts in LoadTruetype at truetype.go#L54+. The vertical glyph bounds computed by freetype-go are not correct for certain fonts. Right now we manually offset the value by added 4 to the height. This is an unreliable hack and should be fixed.
  • freetype-go does not expose AdvanceHeight for vertically rendered fonts. This may mean that the Advance size for top-to-bottom fonts is incorrect.

Dependencies

This packages uses freetype-go which is licensed under GPLv2 e FTL licenses. You can choose which one is a better fit for your use case but FTL requires you to give some form of credit to Freetype.org

You can read the GPLv2 and FTL licenses for more information about the requirements.

Usage

go get github.com/go-gl/gltext

Refer to go-gl/examples/gltext for usage examples.

License

Copyright 2012 The go-gl Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

gltext's People

Contributors

brychanrobot avatar cho45 avatar dmitshur avatar komiga avatar mibk avatar pwaller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gltext's Issues

Occasional memory corruption

There is an occasional memory corruption which cause an application using gltext to crash when loading a truetype font.

It can be reproduce it by running the gltext example at https://github.com/go-gl/examples/blob/master/gltext/truetype/main.go with DejaVuSans font instead, usually located at "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf" in ubuntu systems. It doesn't always happen, you may need to run it a couple of times until the problem occurs.

Library is untested and has no examples

This repository is made by enthusiasts. Unfortunately it's not ready-to-ship code, and may require some expertise to use.

We should add some good examples. Unfortunately, neither me nor @jteeuwen (AFAIK) have time to work on this at the moment, so help is welcomed!

Feel free to ping this thread on a frequency less than once/month to show your interest.

Supercedes #18 #19 #20 go-gl/gl#58

Unbuildable

Are there any plans to refresh this package to work with the new go-gl ecosystem? Can I help somehow? It depends for example on go-gl/glh which was moved to go-gl-legacy. Anybody's got an idea how to make this package working again?

Thank you.

gltext.LoadTruetype get me "GL error: 1282", Please help!

Hi im using gltext in my little project and i have a errorwhile loading font from "./font/Roboto-Light.ttf" i getting GL error 1282 i can't fix it

	fd, err := os.Open(file)
	if err != nil {
		return nil, err
	}
	defer fd.Close()

	return gltext.LoadTruetype(fd, scale, 32, 127, gltext.LeftToRight)
}```

```func initFonts() {
	var err error
	for i := range fonts {
		fmt.Printf("[%d] [LOADING] Loading font of scale %d\n", i, int32(12+i))
		fonts[i], err = loadFont("./font/Roboto-Light.ttf", int32(12+i))
		if err != nil {
			log.Printf("failed while init fonts: %v", err)
			return
		}
		defer fonts[i].Release()
		fmt.Printf("[%d] [OK] successfully loaded font of scale %d\n", i, int32(12+i))
	}
}```

OpenGL ES 2

I wonder if there is any interest to add support for OpenGL ES 2 via interfaces/build constraints. Thanks!

Freetype GPL license contaminates binaries built with gltext

As in go-gl-legacy/glh#41, freetype has a GPL license. As I understand it, our license is compatible with that, but anyone shipping binaries would have to do so under the terms of the GPL (as well as the BSD terms). Which is not ideal.

So we need to find a way out of this mess. Help is welcomed. Some starting points:

  • Re-license this project to GPL (not my favourite)
  • Build an interface which uses harfbuzz or otherwise achieve text rendering without freetype

/cc @andrebq @jteeuwen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.