File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -134,8 +134,8 @@ public function writeMatrix(MaskPattern $maskPattern):QRMatrix{
134
134
*
135
135
* @throws \chillerlan\QRCode\Data\QRCodeDataException
136
136
*/
137
- private function estimateTotalBitLength ():int {
138
- $ length = 0 ;
137
+ public function estimateTotalBitLength ():int {
138
+ $ length = 4 ; // 4 bits for the terminator
139
139
$ margin = 0 ;
140
140
141
141
foreach ($ this ->dataSegments as $ segment ){
@@ -146,6 +146,12 @@ private function estimateTotalBitLength():int{
146
146
// mode length bits margin to the next breakpoint
147
147
$ margin += ($ segment instanceof Byte) ? 8 : 2 ;
148
148
}
149
+
150
+ if ($ segment instanceof Hanzi){
151
+ // Hanzi mode sets an additional 4 bit long subset identifier
152
+ $ length += 4 ;
153
+ }
154
+
149
155
}
150
156
151
157
foreach ([9 , 26 , 40 ] as $ breakpoint ){
@@ -168,7 +174,7 @@ private function estimateTotalBitLength():int{
168
174
*
169
175
* @throws \chillerlan\QRCode\Data\QRCodeDataException
170
176
*/
171
- private function getMinimumVersion ():Version {
177
+ public function getMinimumVersion ():Version {
172
178
173
179
if ($ this ->options ->version !== Version::AUTO ){
174
180
return new Version ($ this ->options ->version );
You can’t perform that action at this time.
0 commit comments