Skip to content

Commit

Permalink
Merge pull request #49 from wri/staging
Browse files Browse the repository at this point in the history
fix(reports): update hasBurmese
  • Loading branch information
edward3sc authored Dec 11, 2024
2 parents cf3e060 + 0db7b4c commit 0c88307
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/src/services/reportFile.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const PDFDocument = require("pdfkit");
const ConvertService = require("./convert.service");
//const GeostoreService = require("./geostore.service");
import logger from "../logger";
import { isBurmese } from "../utils/isBurmese";
import { hasBurmese } from "../utils/isBurmese";

const allowedFields = [
"reportName",
Expand Down Expand Up @@ -540,7 +540,7 @@ class ReportFileService {
}
} else textToPrint = value;

doc.font(isBurmese(textToPrint) ? "Burmese" : "Regular");
doc.font(hasBurmese(textToPrint) ? "Burmese" : "Regular");
doc.fontSize(13).text(textToPrint, 80 + 250 * (i % 2), 170 + ((i - (i % 2)) / 2) * 50);
doc.font("Regular");
});
Expand Down Expand Up @@ -585,7 +585,7 @@ class ReportFileService {
});
else {
doc
.font(isBurmese(responseToShow) ? "Burmese" : "Regular")
.font(hasBurmese(responseToShow) ? "Burmese" : "Regular")
.fontSize(11)
.text(responseToShow, 50, doc.y, { underline: false }); //, lineY + 30 + 50 * i);
doc.moveDown(1);
Expand Down
8 changes: 4 additions & 4 deletions app/src/utils/isBurmese.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Check if the text contains only Burmese characters
* Check if the text contains atleast one Burmese character
* @param {String} text The text to check
* @returns {Boolean} True if the text contains only Burmese characters, false otherwise
* @returns {Boolean} True if the text contains atleast one Burmese character, false otherwise
*/
export function isBurmese(text) {
return /^[\u1000-\u109F\s]+$/.test(text);
export function hasBurmese(text) {
return /[\u1000-\u109F]/.test(text);
}

0 comments on commit 0c88307

Please sign in to comment.