The coordinates of points on the ROC curve are true positive rate (TPR) and false positive rate (TPR). These are given by: $$ TPR=TP/(TP+FN)$$ and $$ FPR=TP/(TP+FP)$$ The F1 score is given by: $$F_1=2*precision*recall/(precision + recall)$$ where $recall=TPR$ and $precision=1-FPR$.
So in order to calculate the maximum $F_1$ score, you have to calculate it at every point on the curve, where you take the $TPR$ value for $recall$ and the $FPR$ value for $1-precision$.