Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text height not working #34

Closed
pcapanna opened this issue Mar 29, 2017 · 3 comments
Closed

text height not working #34

pcapanna opened this issue Mar 29, 2017 · 3 comments
Assignees

Comments

@pcapanna
Copy link
Contributor

pcapanna commented Mar 29, 2017

When setting other sizes other than 1x1, 1x2, 2x1 or 2x2, text height is always 1, and width whatever you put on it.

I had to add a function on commands.js.. but it works fine and I didn't have to add 64 lines of literals possibilities.

I changed/added on commands.js:

_.TEXT_FORMAT = {
  ...
  TXT_OTHER_SIZE  : function(width, height){ // other sizes
    var charsPreSize = '\x1d\x21';
    var decWidth = (width - 1) * 16;
    var decHeight = height - 1;
    var charPostSize = String.fromCharCode(decWidth+decHeight)
    return charsPreSize + charPostSize;
  },

And on printer.js on size function:

Printer.prototype.size = function(width, height) {

  if (2 >= width && 2 >= height) {
    ...
  }
  else {
    this.buffer.write(_.TEXT_FORMAT.TXT_OTHER_SIZE(width,height));
  }
@carbon-steel
Copy link

I ran into the same issue as the one you described. Thanks for putting up a potential solution. I'll give it a try if I find that I need it. :)

@song940 song940 self-assigned this Apr 10, 2017
@song940 song940 closed this as completed in b6ac6b4 May 1, 2017
@pcapanna
Copy link
Contributor Author

pcapanna commented May 2, 2017

Why was this issue closed? I can't see the changes in b6ac6b4, only code formating. I will make a pull request about this so it's easier.

@pcapanna
Copy link
Contributor Author

pcapanna commented May 2, 2017

#43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants