• 小程序,Canvas,文本换行


    texts: [
                {
                    x: 50,
                    y: 660,
                    baseLine: 'middle',
                    text: '',       //标题
                     500,
                    lineNum:2,
                    fontWeight:'bold',
                    fontSize: 32,
                    color: '#333333'
                }
          ]
    

    texts字段

    字段名 类型 必填 描述
    x Number(单位:rpx) 坐标
    y Number(单位:rpx) 坐标
    text String|Object 当Object类型时,参数为text字段的参数,marginLeft、marginRight这两个字段可用(示例请看下文)
    fontSize Number(单位:rpx) 文字大小
    color String 颜色
    opacity Int 1为不透明,0为透明
    lineHeight Number(单位:rpx) 行高
    lineNum Int 根据宽度换行,最多的行数
    width Number(单位:rpx) 没有指定为画布宽度
    marginLeft Number(单位:rpx) 当text字段为Object可以使用,用来控制多行文字间距
    marginRight Number(单位:rpx) 当text字段为Object可以使用,用来控制多行文字间距
    textDecoration String 目前只支持 line-through(贯穿线),默认为none
    baseLine String top| middle|bottom基线对齐方式
    textAlign String left|center|right对齐方式
    zIndex Int 层级,越大越高
    fontFamily String 小程序默认字体为'sans-serif', 请输入小程序支持的字体,例如:'STSong'
    fontWeight String 'bold'加粗字体,目前小程序不支持 100 - 900 加粗
    fontStyle String 'italic'倾斜字体

    官方地址:
    https://gitee.com/acrazydr/wxa-plugin-canvas

  • 相关阅读:
    虚函数中的变量作用域问题
    C++技能重拾2
    C++技能重拾
    位运算取第一个非0的位 r & (~(r-1))
    ThoughtWorks微服务架构交流心得
    字符串匹配的sunday算法
    Codeforces Round #270(利用prim算法)
    HDFS建筑与shell操作
    Spark SQL 源代码分析系列
    HDU 4686 Arc of Dream(递归矩阵加速)
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/12844054.html
Copyright © 2020-2023  润新知