diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index 9b3ad248..c8c4da63 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -15,7 +15,7 @@ jobs: go-version: 'stable' - name: Install analysis tools - run: go install honnef.co/go/tools/cmd/staticcheck@v0.6.0 + run: go install honnef.co/go/tools/cmd/staticcheck@v0.8.0 - name: Vet run: go vet ./... diff --git a/font/cff/cff2.go b/font/cff/cff2.go index 18f721bc..57e8f50a 100644 --- a/font/cff/cff2.go +++ b/font/cff/cff2.go @@ -9,8 +9,6 @@ import ( "github.com/go-text/typesetting/font/opentype/tables" ) -//go:generate ../../../../typesetting-utils/generators/binarygen/cmd/generator . _src.go - // CFF2 represents a parsed 'CFF2' Opentype table. type CFF2 struct { fdSelect fdSelect // maybe nil if there is only one font dict diff --git a/font/cff/cff_gen.go b/font/cff/cff_gen.go index 53ede583..937a69c7 100755 --- a/font/cff/cff_gen.go +++ b/font/cff/cff_gen.go @@ -7,7 +7,9 @@ import ( "fmt" ) -// Code generated by binarygen from cff2_src.go. DO NOT EDIT +// Code generated by binarygen from cff_src.go. DO NOT EDIT + +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. func (item *header2) mustParse(src []byte) { _ = src[4] // early bound checking diff --git a/font/cff/cff_src.go b/font/cff/cff_src.go index dbfe540a..dd6340ca 100644 --- a/font/cff/cff_src.go +++ b/font/cff/cff_src.go @@ -6,7 +6,7 @@ import ( "github.com/go-text/typesetting/font/opentype/tables" ) -//go:generate ../../../../../typesetting-utils/generators/binarygen/cmd/generator . _src.go +//go:generate ../../../typesetting-utils/generators/binarygen/cmd/generator . _src.go type header2 struct { majorVersion uint8 // Format major version. Set to 2. diff --git a/font/opentype/tables/aat_ankr_gen.go b/font/opentype/tables/aat_ankr_gen.go index 169df984..17b05931 100755 --- a/font/opentype/tables/aat_ankr_gen.go +++ b/font/opentype/tables/aat_ankr_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from aat_ankr_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *AnkrAnchor) mustParse(src []byte) { _ = src[3] // early bound checking item.X = int16(binary.BigEndian.Uint16(src[0:])) diff --git a/font/opentype/tables/aat_feat_gen.go b/font/opentype/tables/aat_feat_gen.go index 4d82df23..3abdf37c 100755 --- a/font/opentype/tables/aat_feat_gen.go +++ b/font/opentype/tables/aat_feat_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from aat_feat_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *FeatureSettingName) mustParse(src []byte) { _ = src[3] // early bound checking item.Setting = binary.BigEndian.Uint16(src[0:]) diff --git a/font/opentype/tables/aat_kerx_gen.go b/font/opentype/tables/aat_kerx_gen.go index 295a5152..d40c9719 100755 --- a/font/opentype/tables/aat_kerx_gen.go +++ b/font/opentype/tables/aat_kerx_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from aat_kerx_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *KAAnchor) mustParse(src []byte) { _ = src[3] // early bound checking item.Mark = binary.BigEndian.Uint16(src[0:]) diff --git a/font/opentype/tables/aat_ltag_gen.go b/font/opentype/tables/aat_ltag_gen.go index 972bba88..95933d0a 100755 --- a/font/opentype/tables/aat_ltag_gen.go +++ b/font/opentype/tables/aat_ltag_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from aat_ltag_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func ParseLtag(src []byte) (Ltag, int, error) { var item Ltag n := 0 diff --git a/font/opentype/tables/aat_mortx_gen.go b/font/opentype/tables/aat_mortx_gen.go index fcd17bf2..76642f57 100755 --- a/font/opentype/tables/aat_mortx_gen.go +++ b/font/opentype/tables/aat_mortx_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from aat_mortx_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *AATFeature) mustParse(src []byte) { _ = src[11] // early bound checking item.FeatureType = binary.BigEndian.Uint16(src[0:]) diff --git a/font/opentype/tables/aat_trak_gen.go b/font/opentype/tables/aat_trak_gen.go index f60d477f..a72bd3b1 100755 --- a/font/opentype/tables/aat_trak_gen.go +++ b/font/opentype/tables/aat_trak_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from aat_trak_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func ParseTrackData(src []byte, parentSrc []byte) (TrackData, int, error) { var item TrackData n := 0 diff --git a/font/opentype/tables/cmap_gen.go b/font/opentype/tables/cmap_gen.go index e10d6c82..7cfaef31 100755 --- a/font/opentype/tables/cmap_gen.go +++ b/font/opentype/tables/cmap_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from cmap_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *CmapSubtable0) mustParse(src []byte) { _ = src[261] // early bound checking item.format = binary.BigEndian.Uint16(src[0:]) diff --git a/font/opentype/tables/glyphs_bitmap_gen.go b/font/opentype/tables/glyphs_bitmap_gen.go index 27ef0fa5..4af11e2e 100755 --- a/font/opentype/tables/glyphs_bitmap_gen.go +++ b/font/opentype/tables/glyphs_bitmap_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from glyphs_bitmap_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *BigGlyphMetrics) mustParse(src []byte) { _ = src[7] // early bound checking item.SmallGlyphMetrics.mustParse(src[0:]) @@ -123,7 +125,7 @@ func ParseBitmapData1Or2(src []byte) (BitmapData1Or2, int, error) { var item BitmapData1Or2 n := 0 if L := len(src); L < 5 { - return item, 0, fmt.Errorf("reading BitmapData1or2: "+"EOF: expected length: 5, got %d", L) + return item, 0, fmt.Errorf("reading BitmapData1Or2: "+"EOF: expected length: 5, got %d", L) } item.SmallGlyphMetrics.mustParse(src[0:]) n += 5 diff --git a/font/opentype/tables/glyphs_colr_gen.go b/font/opentype/tables/glyphs_colr_gen.go index e75399df..78ecd1e0 100755 --- a/font/opentype/tables/glyphs_colr_gen.go +++ b/font/opentype/tables/glyphs_colr_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from glyphs_colr_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *Affine2x3) mustParse(src []byte) { _ = src[23] // early bound checking item.Xx = Float1616FromUint(binary.BigEndian.Uint32(src[0:])) diff --git a/font/opentype/tables/glyphs_cpal_gen.go b/font/opentype/tables/glyphs_cpal_gen.go index f408afd6..011ab984 100755 --- a/font/opentype/tables/glyphs_cpal_gen.go +++ b/font/opentype/tables/glyphs_cpal_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from glyphs_cpal_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *ColorRecord) mustParse(src []byte) { _ = src[3] // early bound checking item.Blue = src[0] diff --git a/font/opentype/tables/glyphs_glyf_gen.go b/font/opentype/tables/glyphs_glyf_gen.go index 5ff7790f..51a05e2f 100755 --- a/font/opentype/tables/glyphs_glyf_gen.go +++ b/font/opentype/tables/glyphs_glyf_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from glyphs_glyf_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *CompositeGlyphPart) mustParse(src []byte) { _ = src[23] // early bound checking item.Flags = binary.BigEndian.Uint16(src[0:]) diff --git a/font/opentype/tables/glyphs_misc_gen.go b/font/opentype/tables/glyphs_misc_gen.go index d7f58a12..20d0d572 100755 --- a/font/opentype/tables/glyphs_misc_gen.go +++ b/font/opentype/tables/glyphs_misc_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from glyphs_misc_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func ParseSVG(src []byte) (SVG, int, error) { var item SVG n := 0 diff --git a/font/opentype/tables/glyphs_sbix_gen.go b/font/opentype/tables/glyphs_sbix_gen.go index 7dc38ce8..93f49606 100755 --- a/font/opentype/tables/glyphs_sbix_gen.go +++ b/font/opentype/tables/glyphs_sbix_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from glyphs_sbix_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func ParseBitmapGlyphData(src []byte) (BitmapGlyphData, int, error) { var item BitmapGlyphData n := 0 diff --git a/font/opentype/tables/head_gen.go b/font/opentype/tables/head_gen.go index af61deaa..4e9845fa 100755 --- a/font/opentype/tables/head_gen.go +++ b/font/opentype/tables/head_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from head_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *Head) mustParse(src []byte) { _ = src[53] // early bound checking item.majorVersion = binary.BigEndian.Uint16(src[0:]) diff --git a/font/opentype/tables/hhea_vhea_gen.go b/font/opentype/tables/hhea_vhea_gen.go index bdfa1df2..35059327 100755 --- a/font/opentype/tables/hhea_vhea_gen.go +++ b/font/opentype/tables/hhea_vhea_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from hhea_vhea_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *Hhea) mustParse(src []byte) { _ = src[35] // early bound checking item.majorVersion = binary.BigEndian.Uint16(src[0:]) diff --git a/font/opentype/tables/hmtx_vmtx_gen.go b/font/opentype/tables/hmtx_vmtx_gen.go index ec00258d..94021c21 100755 --- a/font/opentype/tables/hmtx_vmtx_gen.go +++ b/font/opentype/tables/hmtx_vmtx_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from hmtx_vmtx_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *LongHorMetric) mustParse(src []byte) { _ = src[3] // early bound checking item.AdvanceWidth = int16(binary.BigEndian.Uint16(src[0:])) diff --git a/font/opentype/tables/kern_gen.go b/font/opentype/tables/kern_gen.go index 17388a30..be3718b6 100755 --- a/font/opentype/tables/kern_gen.go +++ b/font/opentype/tables/kern_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from kern_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func ParseAATKernSubtableHeader(src []byte) (AATKernSubtableHeader, int, error) { var item AATKernSubtableHeader n := 0 diff --git a/font/opentype/tables/maxp_gen.go b/font/opentype/tables/maxp_gen.go index 7639dcee..3e79d8ce 100755 --- a/font/opentype/tables/maxp_gen.go +++ b/font/opentype/tables/maxp_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from maxp_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func ParseMaxp(src []byte) (Maxp, int, error) { var item Maxp n := 0 diff --git a/font/opentype/tables/name_gen.go b/font/opentype/tables/name_gen.go index ea57daa4..0018e043 100755 --- a/font/opentype/tables/name_gen.go +++ b/font/opentype/tables/name_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from name_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func ParseName(src []byte) (Name, int, error) { var item Name n := 0 diff --git a/font/opentype/tables/os2_gen.go b/font/opentype/tables/os2_gen.go index d0f0154a..b72ad101 100755 --- a/font/opentype/tables/os2_gen.go +++ b/font/opentype/tables/os2_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from os2_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func ParseOs2(src []byte) (Os2, int, error) { var item Os2 n := 0 diff --git a/font/opentype/tables/ot_gdef_gen.go b/font/opentype/tables/ot_gdef_gen.go index 74dc1da1..c9176889 100755 --- a/font/opentype/tables/ot_gdef_gen.go +++ b/font/opentype/tables/ot_gdef_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from ot_gdef_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *CaretValue1) mustParse(src []byte) { _ = src[3] // early bound checking item.caretValueFormat = binary.BigEndian.Uint16(src[0:]) diff --git a/font/opentype/tables/ot_gpos_gen.go b/font/opentype/tables/ot_gpos_gen.go index 2022ab32..f581eabb 100755 --- a/font/opentype/tables/ot_gpos_gen.go +++ b/font/opentype/tables/ot_gpos_gen.go @@ -7,10 +7,10 @@ import ( "fmt" ) -//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. - // Code generated by binarygen from ot_gpos_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *AnchorFormat1) mustParse(src []byte) { _ = src[5] // early bound checking item.anchorFormat = binary.BigEndian.Uint16(src[0:]) @@ -1489,6 +1489,7 @@ func ParsePairPosData2(src []byte) (PairPosData2, int, error) { } } { + item.classData = src[0:] } return item, n, nil diff --git a/font/opentype/tables/ot_gsub_gen.go b/font/opentype/tables/ot_gsub_gen.go index 56a3e070..90846154 100755 --- a/font/opentype/tables/ot_gsub_gen.go +++ b/font/opentype/tables/ot_gsub_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from ot_gsub_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func ParseAlternateSet(src []byte) (AlternateSet, int, error) { var item AlternateSet n := 0 diff --git a/font/opentype/tables/ot_layout.go b/font/opentype/tables/ot_layout.go index ea146ff6..fcabf745 100644 --- a/font/opentype/tables/ot_layout.go +++ b/font/opentype/tables/ot_layout.go @@ -548,7 +548,6 @@ func parseValueRecord(format ValueFormat, data []byte, offset int) (out ValueRec return out, 0, err } } - cursor++ // useless actually } return out, offset + 2*size, err } diff --git a/font/opentype/tables/ot_layout_gen.go b/font/opentype/tables/ot_layout_gen.go index fcf1fdbb..5d10c57d 100755 --- a/font/opentype/tables/ot_layout_gen.go +++ b/font/opentype/tables/ot_layout_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from ot_layout_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *ConditionFormat1) mustParse(src []byte) { _ = src[7] // early bound checking item.format = binary.BigEndian.Uint16(src[0:]) diff --git a/font/opentype/tables/post_gen.go b/font/opentype/tables/post_gen.go index ec94d4c8..d64306e8 100755 --- a/font/opentype/tables/post_gen.go +++ b/font/opentype/tables/post_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from post_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func ParsePost(src []byte) (Post, int, error) { var item Post n := 0 diff --git a/font/opentype/tables/xvar_gen.go b/font/opentype/tables/xvar_gen.go index eb194e84..23662174 100755 --- a/font/opentype/tables/xvar_gen.go +++ b/font/opentype/tables/xvar_gen.go @@ -9,6 +9,8 @@ import ( // Code generated by binarygen from xvar_src.go. DO NOT EDIT +//lint:file-ignore SA4006 The code generator is not smart enough to remove unused variables. + func (item *AxisRecord) mustParse(src []byte) { _ = src[7] // early bound checking item.Tag = Tag(binary.BigEndian.Uint32(src[0:])) diff --git a/harfbuzz/ot_shape_hangul.go b/harfbuzz/ot_shape_hangul.go index 681f4cad..f9f1c37d 100644 --- a/harfbuzz/ot_shape_hangul.go +++ b/harfbuzz/ot_shape_hangul.go @@ -296,7 +296,6 @@ func (cs *complexShaperHangul) preprocessText(_ *otShapePlan, buffer *Buffer, fo i++ if i < end { info[i].complexAux = tjmo - i++ } buffer.mergeOutClusters(start, end) diff --git a/harfbuzz/ot_shape_indic.go b/harfbuzz/ot_shape_indic.go index c1294e5f..5f6a007a 100644 --- a/harfbuzz/ot_shape_indic.go +++ b/harfbuzz/ot_shape_indic.go @@ -1319,10 +1319,6 @@ func (indicPlan *indicShapePlan) finalReorderingSyllableIndic(buffer *Buffer, st tmp := info[oldPos] copy(info[newPos+1:], info[newPos:oldPos]) info[newPos] = tmp - - if newPos <= base && base < oldPos { - base++ - } } }