set_font_size.go 404 B

123456789101112131415161718192021
  1. // License: GPLv3 Copyright: 2022, Kovid Goyal, <kovid at kovidgoyal.net>
  2. package at
  3. import (
  4. "strconv"
  5. )
  6. func parse_set_font_size(arg string, payload *set_font_size_json_type) error {
  7. if len(arg) > 0 && (arg[0] == '+' || arg[0] == '-') {
  8. payload.Increment_op = arg[:1]
  9. arg = arg[1:]
  10. }
  11. val, err := strconv.ParseFloat(arg, 64)
  12. if err != nil {
  13. return err
  14. }
  15. payload.Size = val
  16. return nil
  17. }