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

Need to open getter for Style properties #68

Closed
OumaSyuu opened this issue Jun 21, 2021 · 4 comments
Closed

Need to open getter for Style properties #68

OumaSyuu opened this issue Jun 21, 2021 · 4 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@OumaSyuu
Copy link

Hi, I want to know is it possible to open getter for Style properties:

    private FontName fontName;
    private boolean bold;
    private Underline underline;
    private FontSize fontWidth;
    private FontSize fontHeight;
    private Justification justification;
    private boolean defaultLineSpacing;
    private int lineSpacing;
    private ColorMode colorMode;

I have got pos printers that support Chinese characters. And the underline setting is not working on Chinese characters(need to write command "FS-"). Ive tried to override getConfigBytes with custom style class, but I cant access the underline property.

@OumaSyuu OumaSyuu added the enhancement New feature or request label Jun 21, 2021
@OumaSyuu
Copy link
Author

OumaSyuu commented Jun 21, 2021

Plus, some of the printers are behaving weird with style setting(justification setting not working). I want to do some adaptations with custom style and no reflection.

@anastaciocintra
Copy link
Owner

Hi @OumaSyuu,
Good question. Unfortunately, my printer (epson TM-T20)haven't the feature to print Chinese characters, in the past I've testing(sandbox) FS command without success.

public class Chinese {
    int FS = 0x1c;

    void exec(EscPos escpos) throws IOException {
        /**
        public function textChinese(string $str = "")
        {
            $this -> connector -> write(self::FS . "&");
            $str = \UConverter::transcode($str, "GBK", "UTF-8");
            $this -> buffer -> writeTextRaw((string)$str);
            $this -> connector -> write(self::FS . ".");
        }
         **/
        escpos.write(FS).write("&");
        String text = "艾德蒙 AOC E2450SWH 23.6吋 LED液晶寬螢幕特價$ 19900\n\n";
        byte [] x = text.getBytes("BIG5");
        escpos.write(x,0,x.length);
        escpos.write(FS).write(".");
        escpos.feed(5).cut(EscPos.CutMode.FULL);
    }

Plus, some of the printers are behaving weird with style setting

Ok, some printers can't recognize the textStyle commands, you can try the textprintmodestyle. text print mode style class / more explanation

Ive tried to override getConfigBytes with custom style class, but I cant access the underline property.

Hey, you found one architectural problem. I need to transform the attributes in protect instead of privates ! I'll do the corrections to the next release. And then you will be able to make your own inherited style commands.

@anastaciocintra anastaciocintra added the bug Something isn't working label Jun 21, 2021
@anastaciocintra anastaciocintra self-assigned this Jun 21, 2021
@anastaciocintra
Copy link
Owner

released... v4.1.0

@OumaSyuu
Copy link
Author

Thanks for help. It works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants