Giter VIP home page Giter VIP logo

amanithvg-sdk's Issues

vgDrawGlyphs possibly not using adjustments properly

When a string of text is drawn with vgDrawGlyphs, it seems to be reading the adjustment values from the wrong locations in the provided array. For character 0, it is not using any adjustment value, only using the position set to VG_GLYPH_ORIGIN. For character 1, it uses the adjustment value in adjustments[0].

To demonstrate, if I had the following code:

VGuint indices[strlen];
VGfloat x_adjustments[strlen];
VGfloat y_adjustments[strlen];

for (int i = 0; i < strlen; i++) {

    /* Find computed values */

    indices[i] = computed_index;
    x_adjustments[i] = computed_x_adjustment;
    y_adjustments[i] = computed_y_adjustment;
}

vgSetfv (VG_GLYPH_ORIGIN, 2, overall_origin);
vgDrawGlyphs (font,
              strlen,
              indices,
              x_adjustments,
              y_adjustments,
              VG_FILL_PATH,
              VG_FALSE);

I would have to change it to this for it to use the adjustment value on character 0 and the correct adjustments on the following characters:

VGuint indices[strlen];
VGfloat x_adjustments[strlen];
VGfloat y_adjustments[strlen];

for (int i = 0; i < strlen; i++) {

    /* Find computed values */

    indices[i] = computed_index;
    x_adjustments[i] = computed_x_adjustment;
    y_adjustments[i] = computed_y_adjustment;
}

VGfloat[2] new_overall_origin = {overall_origin[0] + x_adjustments[0], overall_origin[1] + y_adjustments[0]};
vgSetfv (VG_GLYPH_ORIGIN, 2, new_overall_origin);
vgDrawGlyphs (font,
              strlen,
              indices,
              &x_adjustments[1],
              &y_adjustments[1],
              VG_FILL_PATH,
              VG_FALSE);

However, the specification does seem somewhat ambiguous about this, as it says:

The user space position of the first glyph (the point where the glyph origin will be placed) is determined by the value of VG_GLYPH_ORIGIN.

Contrary to one possible interpretation of that, it seems that many applications written against OpenVG use vgDrawGlyphs adjustments as if the 0th value will be used.

Thank you for taking the time to read this. If I could provide any more information, please let me know.

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.